Re-useable text/ markdown blocks - best practice?


#1

instead of pasting the same page content (pure text/ markdown) on some (but not all) pages i would rather like to outsource it and include it on demand.

what would you suggest how to do that?

i did it using twig:
{{ include('path-to-snippet.html.twig') | markdown }}

with:
twig:true in the frontmatter.

and:
{% verbatim %}
in the path-to-snippet.html.twig

but i don’t especially like the markdown-snippet, which is actual content and therefore should be rather located in pages/, residing in the theme/templates directory as twig template.


#2

Hi @oufloued, I am a big fan (and user) of the Page Inject plugin (https://github.com/getgrav/grav-plugin-page-inject), might be something to check-out too?

Examples:
https://raw.githubusercontent.com/hibbitts-design/grav-skeleton-course-hub-site/master/user/pages/mini-home/fullwidthpage.md

https://raw.githubusercontent.com/hibbitts-design/grav-skeleton-course-hub-site/master/user/themes/course-hub-bootstrap/_demo/advanced/01.home/unit-01/item.md


#3

Hi, you may also find this recent discussion relevant: Reuse blocks of content on different pages


#4

indeed. thank you!
(pardon me please for the unexcusable delay)