Hi. I'm pretty new to Grav and I'm trying to display a header image from a file upload in the admin panel in a template. The idea is to upload the image to a folder within the specific page folder (the one that contains the md file) and not a centralised image folder. This way all the content for that page is together if I need to move or delete articles in the future.
YAML:
header.background_image:
type: file
label: Photo image header
destination: 'self@/header_image'
multiple: false
accept:
- image/*
TWIG:
{% for image in page.find('header_image').media.images %}
{{ image.url }}
{% endfor %}
This displays fine when I've linked to a folder relative the the user pages folder, but I can't seem to get it to work in the above example. Am I missing something?
Thanks.