Is there an easier way to put different hero images on different pages? #4462
-
Hello! I've been playing with the hero block functionality. So far I like it, and I'm able to get it to do what I want, which is great! My question is whether there's a better way to be doing it. I only have a few pages where I want hero images, but with a different hero image for each page. The only way I've figured out how to implement the hero image is to use a custom page template for each markdown page where I want a hero image, and then to make separate templates for each page. This all works fine, but I wonder if there's a way I can specify which hero image is used directly from the markdown page versus having to create a separate html template for each? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You could define the hero image via front matter. You could then use that variable, e.g.
In your template: <img src="{{ page.meta.hero }}" /> |
Beta Was this translation helpful? Give feedback.
You could define the hero image via front matter. You could then use that variable, e.g.
page.meta.hero
in your template:In your template: