Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Get page content into template

Started by Muut Archive 10 years ago · 5 replies · 413 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 Deleted User, 9 years ago
0 1355 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4065 9 years ago
Archive · by Muut Archive, 9 years ago
1 2953 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago