Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

SVGs not in page.media

Started by Muut Archive 11 years ago · 4 replies · 533 views
11 years ago

In a page module folder I have a regular SVG. Its the only image file in the folder. The theme runs {% set image = page.media.images|first %} and then {{ image.html }} but nothing is output. If I add a JPEG to that folder, the JPEG loads.

It seems that page.media.images does not include SVG files. Am I missing a setting or is that not supported?

11 years ago

rhukster posted the right answer in the issue tracker:

Because SVG is actually a special kind of image and can't be manipulated with filters, it actually is listed in page.media.files.

Specifically it would be:

{{ page.media.files['firefox.svg'].html }}
or in markdown syntax simply:

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2612 9 years ago
Archive · by Muut Archive, 9 years ago
2 1721 9 years ago
Archive · by Muut Archive, 9 years ago
2 5018 9 years ago
Archive · by Muut Archive, 9 years ago
1 3846 9 years ago
Archive · by Muut Archive, 9 years ago
3 1823 9 years ago