Greetings,
I’m a novice and a dabbler when it comes to web development, so please bear with me. I’m working on a personal project that will, among other things, contain a database of characters in a game I’m running.
I have a character.yaml blueprint and its corresponding character.html.twig template which are both working fine (though the template style and layout is far from finished).
That’s great and I enjoyed figuring out how to do those, but at the moment I’m struggling a bit with Collections.
My goal is to have a page with a grid, or list, of all the characters which then can be clicked on to open a particular characters page.
From my understanding, I would create a blueprint called, for example, characters.yaml with something like:
title: Star Wars Characters
content:
items: '@self.children'
order:
by: date
dir: desc
limit: 10
pagination: true
Then I would create a Characters folder under which I would create each individual character?
Then I need to create a characters.html.twig template that would cycle through each character page and display a portrait, name, or whatever else?
If all of that is correct, then I’m doing something wrong, possibly at multiple levels. I think it may be my characters.html.twig file. Should the following work?:
{% embed 'partials/base.html.twig' %}
{% set collection = page.collection() %}
{% block content %}
<div>
{% for child in collection %}
{{ page.header.character.name }}
{% endfor %}
</div>
{% endblock %}
{% endembed %}
Maybe I should phrase my question better: Could someone explain, perhaps in simpler terms than the manual, how to create a collection of pages and display a list of those pages?
Thank you,
Brian