Search code examples
jekyllgithub-pages

How to show modified posts first in Jekyll?


I know that, Jekyll will show the list of posts depending on the day given in the file like that

2015-01-29-name-of-post.md

On some days later, for example, on 2015-05-12, I have an update on this post and I want Jekyll show it first on the list of "new" posts. I know I can "force" Jekyll to do that by changing the name like

2015-05-12-name-of-post.md

This is not a good idea whereas I want it does automatically. Anyone has other answers?


Solution

  • Here (http://jekyllrb.com/docs/frontmatter/) says there is a special front matter vairable for posts that seem to do what you want:

    "date A date here overrides the date from the name of the post. This can be used to ensure correct sorting of posts. A date is specified in the format YYYY-MM-DD HH:MM:SS +/-TTTT; hours, minutes, seconds, and timezone offset are optional."

    So looks like you could add date to your post's front matter and change it that way.