How to pin a post


I am using pagination, by which a post published gets lots in the deep pages after we published more and more posts.

Is there is any way to pin a post? I mean, can we add anything in the front yaml to pin it.


Don’t think there is an easy way to do it. You’ll likely need to hack the pagination plugin or create your own.

You could probably do something like this:

{% assign pinned = site.posts | where_exp:"item", " == true" %}

Which would pickup any posts that you flag as pin: true in their YAML Front Matter, but it’s not going to remove it from the paginator. Which means you’ll have them double listed.

Unfortunately Jekyll isn’t Wordpress where a lot of these “bloggin” friendly features are baked in. Jekyll gets out of the way and leaves all that logic up to you to develop. End of the day it’s just a tool to convert Markdown files into HTML.


I think there is a very easy way to do this:

  1. Create a yml variable in each post called ‘sticky’, and set some to true.

  2. Exclude sticky posts from your for normal loop, using ‘where’.

  3. Add a sticky posts loop to your template before the normal loop.

  4. Optionally hide the sticky posts loop on paged pages.