Muut
July 31, 2015, 5:31pm
1
I’d like to have a custom page header containing an image asset. Something like:
---
title: Page Title
banner: image.jpg
---
Adding {{ header.banner }}
to the template outputs the image filename, but the path is incorrect so the image doesn’t work.
How can I link to an image asset using a variable from the header?
Muut
July 31, 2015, 9:48pm
2
I guess the ultimate question is where is the image stored? that directly effects the URL. if it’s simply in the same folder as the page, You can do something like:
{{ page.media[header.banner].url() }}
Muut
July 31, 2015, 10:07pm
3
Apologies, I forgot to mention that critical piece of info. The image is currently stored in the same directory.
Your solution works great, thank you!