Hello Ghost Community!
I’m using foreach to iterate over all my posts and list them on my index.hbs. This a screenshot of my code:
That works fine.The posts are listed 11 at a time, then at the bottom users see a “view more” button. So they can see the next 11 posts, etc.
But i am wondering what is the easiest and most elegant way to first show all the posts that are featured on my index page. Of course 11 at a time (like its been done right now), and still have the pagination.
I want to show first all the posts that are featured and then the ones that are not.
I was reading about the get functional helper on the handlebars documentation and also the how to build a related posts block tutorial
Those instructions gave me the idea to use something like this code:
Right before my foreach code block on my index.hbs so that the featured posts will be shown first and above of the regular posts. So now i see on my index page all my featured posts, and then my regular ones. The problem with that approach is that the featured posts are not linked to the pagination logic. For example if i ve had 50 featured posts, of course i could limit them (on the code above they are limited to three) but i want them to be intertwined with the pagination of the regular posts.
So i guess a more elegant solution oughta exists so that the regular posts are just ordered by showing first all of those posts who are featured. Should i be fiddling with the YAML configuration to achieve this?
Can someone point me in the right direction please?
I am using 2.25.0