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.
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", "item.pin == 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:
Create a yml variable in each post called âstickyâ, and set some to true.
Exclude sticky posts from your for normal loop, using âwhereâ.
Add a sticky posts loop to your template before the normal loop.
Optionally hide the sticky posts loop on paged pages.