Start a new topic
Answered

Include contents of a "page" to a web page

Is there a way to include the contents of one or more cms pages to a custom page?


Sample:

On the footer I want to have the contents of contact_us and about_us in two divs:


<div>lorem ipsum...</div>

<div>[content of /pages/contact_us]</div>

<div>[content of /pages/about_us]</div>


Best Answer

Yes, I misunderstood you, 'Include' searched templates only in next theme folders  "templates", "snippets", "layout", "assets". You found right solution how to include pages content to the template.

Next syntax also should work  {{ pages['kundeservice/kjopsinformasjon'].content }} use as index page url property.


You can use {% include 'template-name' %} for this purposes.

I think you misunderstood the question. Your solution is for including snippets and templates I assume.

What I was looking for was including "Pages", the type that is in /App_Data/Pages. (like pages/about_us.md).


Or maybe I misunderstood you. Can you give an example for the syntax? {% include 'page' | name:about_us.md %}

I got it!


{{ pages[settings.test_page].content }}

where I put this: "test_page": "kundeservice/kjopsinformasjon" ([path to page]/[page])

in the config file.

Answer

Yes, I misunderstood you, 'Include' searched templates only in next theme folders  "templates", "snippets", "layout", "assets". You found right solution how to include pages content to the template.

Next syntax also should work  {{ pages['kundeservice/kjopsinformasjon'].content }} use as index page url property.

Login or Signup to post a comment