Featured post at top of homepage

After upgrading to V3 and the new casper theme, I am unable to pin the featured posts to the top of the homepage.

I’ve added the following code to index.hbs and restarted ghost.

{{#foreach posts}}
{{#if featured}}
{{> “post-card”}}
{{/if}}
{{/foreach}}
{{#foreach posts}}
{{^if featured}}
{{> “post-card”}}
{{/if}}
{{/foreach}}

But it hasn’t worked.
I can only get the featured post to show by only using the first section of code:
{{#foreach posts}}
{{#if featured}}
{{> “post-card”}}
{{/if}}
{{/foreach}}

But obviously normal posts don’t show then. So the first code snippet above should work but the featured post does not show.

I haven’t tried this yet but have been meaning to for a while now. Nonetheless, just yesterday I was looking into it and came across an alternate method described on this page which may be of assistance to you.

1 Like