Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Get page content into template

Started by Muut Archive 10 years ago · 5 replies · 587 views
10 years ago

I need a sidebar on my website which can be edited like normal grav page. The sidebar is in the template/partial. How can i get the content of my page "sidebar" imported?

10 years ago

Well, with twig it is easy:

TWIG
{% include 'partials/sidebar.html.twig' %}

There is several grav skeletons that use sidebar, take a look at antimatter or Pinpress.

Hope it helps!

10 years ago

thanks - this works, no more global error. But how do i get file user/pages/sidebar/sidebar.md into the twig-file?

10 years ago

the file is user/pages/sidebar/default.md of course...

10 years ago

Use {{ pages.find('/sidebar').content }}

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 673 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5337 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago