Pinning a featured post to top of home page, on Ghost Pro, using Lyra

I changed my pinned.hbs to limit=“2”, checked “Feature this post” on two non-consecutive posts, and both posts appeared in the first two positions of the index page. Your index.hbs must have the {{> “pinned”}} line above the {{#foreach posts}} line. If you use filter=“featured:true” in pinned.hbs then you should not have the {{#unless featured}} block there. I am using a modified Casper theme, so maybe your theme is causing the problem.

Thanks for the information sharing

Hi @Sage,
If you need any help, please PM me. I am available to help you directly.

Thanks

You can change the routes.yaml file to make the featured posts come first. Download it in labs .

If you add the line: order: featured desc, published_at desc

So it will be this:

routes:

collections:
  /:
permalink: /{slug}/
template: index
order: featured desc, published_at desc

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/
2 Likes

Oh that’s brilliant. Thank you @psychokillerblog, I would never have noticed this feature, it works a treat and is a piece of cake. Once again I narrowly performing surgery on the Theme, despite making lots of varied changes to the site! This is a documented, but hard to find, feature.

Just one tip for others: YAML relies on indentation using spaces, and order needs to appear under the root collection. So it should be:

routes:

collections:
  /:
    permalink: /{slug}/
    template: index
    order: featured desc, published_at desc

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

And then restart Ghost with ghost restart.

2 Likes

The Ghost Pro platform supports marking posts as featured. This allows for a theme to make these posts appear in a special way on the website, like pinning them to the top for example. Since it is supported by the platform, I was quite surprised it was a missing feature in the default Casper theme…. .

1 Like

If all you want to do is bump featured posts to the top, this is literally the easiest way to do this. Thanks!

I’ve made this change to my routes.yaml in GhostPro and my ‘Featured’ posts do not get pinned to the top of homepage or my tag collections - - I’m using Headline theme if that is relevant.

my routes.yaml file looks like this:

routes:

collections:
  /:
    permalink: /{slug}/
    template: index
    order: featured desc, published_at desc

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

Hi all,

I am completely new and I don’t even know where to start!
When you say download the theme from Ghost admin, what does that mean? Is applying the theme not the same?

Thank you!!