How to adjust Jekyll post order?

后端 未结 4 1719
长情又很酷
长情又很酷 2021-02-01 02:34

I have started a Jekyll based blog with a theme jekyll-now. I am new to Jekyll and how it operates (especially Liquid). I understand that new posts need to be as follows: 2014-1

4条回答
  •  情话喂你
    2021-02-01 02:49

    There is an example in the official Jekyll documentation how to create a basic post archive page:
    Displaying an index of posts

    Bonus: For a prettier archive page (grouped by year or year/month), see this answer.


    You're right, I can't find anything in the docs where it says how the posts are ordered, but in fact Jekyll does order them chronologically, with the most recent post first (you can see this if you try the examples I linked above).

    To sort them the other way (the oldest post first), you can use the reversed keyword, according to the Liquid documentation:

    {% for post in site.posts reversed %}
    

    However, I don't know how two posts on the same date are ordered, because I don't write that much posts, so I never had that problem :-)
    You have to try that yourself.

提交回复
热议问题