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

List all pages in site

Started by Muut Archive 10 years ago · 2 replies · 1473 views
10 years ago

Hello again. I need to create a formatted "Site List" page for my site. This would be a hierarchical listing of all pages on the site. I'm guessing that this is the sort of thing that someone else would have already created. Any leads on where I can go to "borrow" some ideas / code?

10 years ago

There's a couple of places you can look for examples of this. But the simplest example is probably the Antimatter theme as that has logic to navigate over all pages to build the menu. This makes use of a macro to support the multiple nested levels:

Another option is to look at the the sitemap plugin that loops over all pages:

10 years ago

rhukster: Thanks for your response. It looks as though the macro approach in the navigation.html.twig template is exactly what is required. I'll give it a whirl tomorrow.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago