Can anyone help me make the page collections work? I can make a page that lists all the children its own folder, but I can’t make a page that lists all the files in a different folder.
I’m trying to follow the guidance in http://learn.getgrav.org/content/collections
I have stripped my page files to the bare bones but still can’t see the problem. These are the bare bones files:
1.home
default.md
03.animalsV1
ant
animal.md
cat
animal.md
listthings1.md
04.animalsV2
listthings2.md
The listthings1.md
file has the following headers, and works fine.
title: animalsV1
content:
items: @self.children
The associated template listthings1.html.twig
produces a list of animals. Fine.
The problem is with the listthings2.md
file. It has these headers, and doesn’t work:
title: animalsV2`
content:
items:
'@page': '/03.animalsV1'
The two associated templates are exactly the same except for a diagnostic message to print the name of the template. Here is the listthings2.html.twig
template:
{% extends 'partials/base.html.twig' %}
{% block content %}
<p>listthings1 template</p>
{{ page.title}}
{{ page.content }}
{% set collection = page.collection() %}
<ul>
{% for child in collection %}
<li><a href="{{ page.url }}/{{ child.slug }}">{{ child.title }} </a></li>
{% endfor %}
</ul>
{% endblock %}
I can tell from the diagnostic that the file has been used, but it produces no list of animals.
I have tried some variations in the header, but to no avail.
Presumably I have misunderstood something. Does anyone have a working example of the '@page': 'filename'
construction?
Thanks in advance,
Thomas