Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

List all pages in site

Started by Muut Archive 11 years ago · 2 replies · 1548 views
11 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?

11 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:

11 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 2289 9 years ago
Archive · by Muut Archive, 9 years ago
2 1504 9 years ago
Archive · by Muut Archive, 9 years ago
2 4754 9 years ago
Archive · by Muut Archive, 9 years ago
1 3570 9 years ago
Archive · by Muut Archive, 9 years ago
3 1627 9 years ago