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 11 years ago · 1 replies · 206 views
11 years ago

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

11 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 1318 9 years ago
Archive · by Muut Archive, 9 years ago
2 915 9 years ago
Archive · by Muut Archive, 9 years ago
2 4044 9 years ago
Archive · by Muut Archive, 9 years ago
1 2920 9 years ago
Archive · by Muut Archive, 9 years ago
3 1104 9 years ago