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.

General

Cannot get modular images to load

Started by amdival 8 years ago · 1 replies · 512 views
8 years ago

This should be simple. Here is my TWIG:
<img src="{{ page.media['thumbnail.png'] }}">

The image does not load.

I get this:
<img src="&lt;img src=" user="" pages="" 02.home_mod="" _437y="" thumbnail.png"="">

8 years ago

Nevermind. I've worked on this for hours, and as soon as I post this, I figure it out.

I should have had:
{{ page.media['thumbnail.png'] }}

I was adding more than what was necessary.

The TWIG that I am using looks more like this now:
{{ page.media[page.header.thumbnail] }}

and I've reduced it to:
{{ media[header.thumbnail] }}

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 76 7 hours ago
General · by pamtbaau, 13 hours ago
1 47 12 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago