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

Pictures from within the header area of a MD-Document

Started by Muut Archive 12 years ago · 1 replies · 286 views
12 years ago

Hey guys ! I wondered lately how to pull in a picture, whose path is given in the header. Thanks!

12 years ago

As markdown is processed before twig, you won't be able to inject a page header variable with twig into a markdown image tag.

However, you could just put a full path to the image and use a regular HTML image tag with the URL set from the page header:

YAML
image_url: /some/path/to/image.jpg
process:
   twig: true

And then this in the content or in a twig template:

TWIG
<img src="{{ page.header.image_url }}" />

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1981 9 years ago
Archive · by Muut Archive, 9 years ago
2 1336 9 years ago
Archive · by Muut Archive, 9 years ago
2 4536 9 years ago
Archive · by Muut Archive, 9 years ago
1 3391 9 years ago
Archive · by Muut Archive, 9 years ago
3 1486 9 years ago