(or displaying projects)
Hey there, so I am working through creating my first template - idea is a cinematography or video portfolio.
I have created a new page “type” called projects in the admin with specific fields. Under the page directory projects, I have children pages of each project item.
On my projects page I have a list of all the projects, and when I click on a project I am able to see the full view.
I was looking to put that “list” of projects into the default.html.twig file and was wondering if this was the best approach.
{% set options = {
items: {
'@page.children': '/projects'
},
'limit': 5,
'order': {
'by': 'date',
'dir': 'desc'
}
} %}
{% set projects = page.collection( options ) %}
<section class="project-items">
{% for p in projects %}
<div class="project-single">
<div class="project-media">
<div class="project-image">
It works totally as expected, however seems a little backwards of thinking. Would love some input!