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

Pictures from within the header area of a MD-Document

Started by Muut Archive 12 years ago · 1 replies · 337 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 2590 9 years ago
Archive · by Muut Archive, 9 years ago
2 1705 9 years ago
Archive · by Muut Archive, 9 years ago
2 4997 9 years ago
Archive · by Muut Archive, 9 years ago
1 3827 9 years ago
Archive · by Muut Archive, 9 years ago
3 1810 9 years ago