Question is: is this the correct approach, or (having performances in mind) should I consider the year based folder - assuming all the articles of that year are stored in the correct folder (which unfortunately is not always the case)? Something like
If you know the year, you only have to get the year folder, so $site->find('articles/2018')->grandChildren() would be the best approach, instead of filtering the whole lot. Much shorter and you don’t have to read the content files.
On a side note, you can define your articles collection one as Kirby collection and then reuse across your site (without having to redefine if you need the collection in multiple places):
I never used Collections. I tried to solve the same problem (reuse the most used queries through the site) with a plugin. So I can pass to the function some arguments if I need to filter the query.
Do collection makes more sense?
(Sorry to bother you, I’m a heavy user of Kirby kb but…)
Excactly, index() gives you a flat list of all pages under a given page. The reason why I added the filter by template is because otherwise the list would include the parent pages (year and month folders)
Sorry, I thought that would be contextual. To call simple reverse-chron lists of blogs posts; I guess to start with on the homepage whuch will at least get my head pointed in the right direction.