Listing Page Twig Template Not Working

I am attempting to make a listing page for my portfolio of work.

To do this, I used the Grav admin to create a page called “Portfolio.” I then created two subpages under it.

After that, I created a twig partial template with the following code:

{% extends 'partials/base.html.twig' %}

{% block content %}
	{% for p in page.collection %}
		<h2>{{ p.title }}</h2>
		{{ p.summary }}
	{% endfor %}

	{{ page.content }}
{% endblock %}

For some reason, though, no listing is displayed and only the Portfolio page’s content diaplays.

Did I miss a step? Thanks so much to anyone who can give me some insigth!

Have you also created the collection in your ‘Portfolio’ page front-matter like so? -

content:
  items: '@self.children'
  order:
    by: date
    dir: desc
1 Like

Aaaah! This solved it. Thank you. For some misguided reason, I thought when you built a collection in the admin, this was done automatically. Good to know! Thank you so much.

@nellygrl Glad it helped.

1 Like