eddiesigner / liebling

Beautiful and clean Ghost theme that is easy and comfortable to use. To get the latest version please head over the releases page 👉🏼
https://github.com/eddiesigner/liebling/releases
MIT License
1.25k stars 594 forks source link

Replace site cover with featured image from page? #520

Open AnnaMariaEriksson opened 1 year ago

AnnaMariaEriksson commented 1 year ago

Hi! Absolutely almost a perfect theme! Love all of it. I just have a question.

Is it possible to replace the site cover image on the index page with the featured image from a page? The reason is that I'm using content collections and pull data from pages, and I'd like the featured image to show instead of the site cover. I've tried just replacing the {{> header background=@site.cover_image}} with {{> header background= featured_image}} and wrapping post or page context around it, but it doesn't work. Please help or guide.

eddiesigner commented 1 year ago

Hi!

I haven't tested myself but I think you can replace the following line (28):

{{> hero background=@site.cover_image}}

with this:

{{#get "posts" id="xxxxxxxxxxxxxxx" as |post|}}
  {{#post}}
    {{> hero background=featured_image}}
  {{/post}}
{{/get}}

Where the id is the id of the page you want to use for this, I think you can see the id of that particular page in the Ghost Admin when you open it in the editor, I think it should look something like 62b7463e710dfa000104732b in the last part of the URL.