Hi folks! Is it possible to include the content of a page into another page? I don't get any useful results, when I'm searching this question.
I have a page with "about us" content, which should included as a modal in every page. So I need to include the {{ page.content }} from the "about us" page into the base.html.twig. Is this possible?
Regards Philip
Very possible: https://github.com/getgrav/grav-plugin-page-inject is the easiest way. Alternatively you can use twig:
{{ page.find('/some/other.page').content }}
If you want to include the same twig template with the same content on every page, you can put do that right in the twig:
{% set page = page.find('some/other/page') %}
<div id="about-us">
{{ page.content }}
</div>
Perfect! Thank you very much, works fine :-)
Is the same possible with modular content?
Hi @parijke , yes it is. If I remember correctly for the Page Inject plugin just added the underscore ('_') character to insert modular content. For example:
[plugin:content-inject](/ux-techniques-guide/_user-interface-design)
Simarily, for the page find command it would be:
{{ page.find('/ux-techniques-guide/_user-interface-design').content } }}
Most helpful comment
Very possible: https://github.com/getgrav/grav-plugin-page-inject is the easiest way. Alternatively you can use twig:
If you want to include the same twig template with the same content on every page, you can put do that right in the twig: