Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace site cover with featured image from page? #520

Open
AnnaMariaEriksson opened this issue May 31, 2023 · 1 comment
Open

Replace site cover with featured image from page? #520

AnnaMariaEriksson opened this issue May 31, 2023 · 1 comment

Comments

@AnnaMariaEriksson
Copy link

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants