Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Accessing images in page folder from modular.html.twig

Started by Muut Archive 9 years ago · 1 replies · 747 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 Deleted User, 9 years ago
0 1281 9 years ago
Archive · by Muut Archive, 9 years ago
2 888 9 years ago
Archive · by Muut Archive, 9 years ago
2 4018 9 years ago
Archive · by Muut Archive, 9 years ago
1 2894 9 years ago
Archive · by Muut Archive, 9 years ago
3 1077 9 years ago