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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Creating a 'listing' page

Started by Muut Archive 9 years ago · 5 replies · 3940 views
9 years ago

I tried to create a listing page following the manual:

The simplest approach to setting this up is to create child pages below the listing page

So from the admin i created a default page and under it i created again from the admin forms three more pages.
I expected that 'magically' the first page will contain a listing of its subpages . but that didnt happen.
What happened is that in the main site meny selecting the page entry a popup menu will list the three subpages.

I guess messing with the frontmatter and twig could make the collection works but i wonder if there is an easier faster way that could be used from a simple user.
Thanks

9 years ago

Ι tried to put the following in the 'listing' page but nothing appears.

content:
items: '@self.children'
order:
by: date
dir: desc
limit: 10
pagination: true

9 years ago

Ok. i did it but by adding the twig sniippet :
{% for p in page.collection %}
<h2>{{ p.title }}</h2>
{{ p.summary }}
{% endfor %}

That is mentioned in the manual. But
i thougth there was a simpler GUI way to create a list page.

9 years ago

Hi, that Twig is necessary, otherwise Grav does not know what to render.

The GUI is there until you step a little bit out of the path and create custom things (like in this case, you're creating a custom page type + a custom template).

9 years ago

The following should be removed

The simplest approach to setting this up is to create child pages below the listing page.

I dont find any 'simplicity" in adding a twig snipped in an active's theme template file which will be 'called' if it's filename mathes the page's filename.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1280 9 years ago
Archive · by Muut Archive, 9 years ago
2 888 9 years ago
Archive · by Muut Archive, 9 years ago
2 4017 9 years ago
Archive · by Muut Archive, 9 years ago
1 2892 9 years ago
Archive · by Muut Archive, 9 years ago
3 1077 9 years ago