Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Accessing images in page folder from modular.html.twig

Started by Muut Archive 9 years ago · 1 replies · 1084 views
9 years ago

I followed docs on your site and used page folder to store images (_intro). Now I have a really hard time finding out how to get relative path of each images dynamically in my twig file. Also is it possible to access _intro folder images from modular.html.twig? thank you!

9 years ago

Yes, using folder paths like shown below. you can point any an images in the modular.html.twig file to the image location.

Path Description
<img src="picture.jpg"> picture.jpg is located in the same folder as the current page
<img src="images/picture.jpg"> picture.jpg is located in the images folder located in the current folder
<img src="/images/picture.jpg"> picture.jpg is located in the images folder located at the root of the current web
<img src="../picture.jpg"> picture.jpg is located in the folder one level up from the current folder

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 672 1 week ago
Archive · by Deleted User, 9 years ago
0 3042 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5336 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago