Skip to content
● Critical PHP security fixes are out: update PHP on your Grav sites. What to do →

Inserting images into markdown

admin

Started by Owain Catton 4 years ago · 4 replies · 1859 views
4 years ago

When you insert and image into the markdown of a page content from the editor, either by dragging/dropping or via the plus icon on the hover menu. Is it possible for the inserted markdown code, e.g. !(alt text)[image.jpg "image title"), to be read from an existing .meta.yaml file if present.

4 years ago

Not without coding, which I am guessing is off the table.

The best approach would be to customise your Twig template (so further down the pipeline) so that it pulls this information from your .meta.yaml file and adds it as a title attribute.

4 years ago

Yeah that is a bit beyond me but thanks for the direction. Maybe when I have spent more time with Grav I will investigate

4 years ago

I did something like this for Blog image headers, where you could provide some image credit text and even a link to be overlaid with the image, in my Open Bootstrap 4 theme - sample Twig https://github.com/hibbitts-design/grav-theme-bootstrap4-open-matter/blob/master/templates/partials/blog_item.html.twig#L76-L101 and live sample image https://demo.hibbittsdesign.org/grav-open-matter-course-hub/home/module-04

I am sure (LOL) that the twig could be improved but perhaps this might give you a few useful ideas etc.
Paul

👍 1

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 12 months ago
6 1285 12 months ago
Content & Markdown · by Ton Haarmans, 2 years ago
10 1015 1 year ago
Content & Markdown · by Jan L'Am, 2 years ago
4 890 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 815 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 1233 2 years ago