Hi to the Grav community,
I started with Grav by creating an inerited theme of Qwark.
I put the media files in user/pages/images with {% set my_image = page.find('/images').media['my-image.jpg'] %} .
After that I wanted my hero image to come from the pages/images folder, so I did this :
@pamtbaau:
If you want the template to find an image in the pages/images folder, do the following:
- In the page’s frontmatter do:
hero_image: small-bandpic.png
Note: No path prepended- In the template item.html.twig file:
{% set hero_image = page.find(’/images’).media[hero_image_name] %}
Each page of the site is only composed by images.
My final objective is to create a modular page made of hero images from the pages of my website, each hero will take a random picture of the page.
My problem is : how to make each hero image random and filtered differently ? (for example only images including the letter L). I know a randomize function exists but I don't kow how to apply it with different filters on each hero.
Sorry for my bad english, and also i don't know anything to code...
Best regards.