-
Notifications
You must be signed in to change notification settings - Fork 25.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
archive won't display posts in reverse order (most recent first) #1058
Comments
You may want to ask this question on https://talk.jekyllrb.com/ as it's not a theme specific one. I believe your issue is your trying to list collection documents ( To do that I believe you'd have to add a |
Interesting - where is the date field added on the demo site? I don't see it in the YAML front matter of the posts. The defaults for _scribbles and _brainplay were copied from _posts, so shouldn't they work the same way? |
The date field isn't add to the demo site. That's because what you're seeing there are "posts"... which automatically get You're trying to do that with "collections", which don't share that behavior. Instead I believe they are sorted alphabetically by default. I'd inquire in the Jekyll forum or Stackoverflow as it's a core Jekyll behavior and not theme related. |
ok, I see now - so re-naming _scribbles to _post got the reverse chrono listing to work, but now the "year" headers won't render properly in the webpage. Is this also a Jekyll behaviour? |
That's because you're using Markdown and it thinks the indented Either rename the file to {% capture written_year %}'None'{% endcapture %}
{% for post in site.posts %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}
<h2 id="{{ year | slugify }}" class="archive__subtitle">{{ year }}</h2>
{% capture written_year %}{{ year }}{% endcapture %}
{% endif %}
{% include archive-single.html %}
{% endfor %} |
Amazing! Thanks for the super fast and helpful replies! |
Relatively self-explanatory, pulled out of mmistakes#1058
bundle update
.bundle exec jekyll build
.Environment informations
github-pages
orjekyll
gem version: 'github-pages', I'm doing everything through the browserExpected behavior
I'm trying to list posts in reverse order, so that the most recent post shows up first.
Steps to reproduce the behavior
Repository for my website is here: https://github.com/taunsquared/taunsquared.github.io
The two pages I'm trying to get to list posts are
/_pages/brainplay.md
and
/_pages/scribbles.md
I took the code directly from Minimal Mistakes' documentation, and I see that it's working correctly on the demo site, so I'm wondering why mine doesn't do the same?
Sorry if this is super obvious, I checked past issues and no one seems to have had this problem before...
The text was updated successfully, but these errors were encountered: