I try to get all articles in my different category folders from my news-page.
My folder structure looks like this :
1_news
0_category
0_architecture
20190101_article-1
20190102_article-2
0_design
20190103_article-3
20190104_article-4
I’ve tried to get the news folder and then the category folder and the child-folders
$news = $site->find('news');
$category = $news->find('category')->children()->listed()->flip();
…but without luck.
Your using Kirby 3 but Please set the correct topic on the thread. I’m not sure how you have ended up with leading zeros either, did you create those manually? The numbering starts from 1 usually. Maybe thats the issue.
Sounds like you basically want the tree menu … see here
I’ve created those manually for alphabetical sorting.
You could do var_dump($category)
to see what’s in it.
1 Like
Thanks that helped.
I’ve came up with a simpler solutions.
# collections/news.php
return function ($site) {
return $site->index()->filterBy('template', 'article');
};
It seems that you can get all pages using the same template wich makes it much easier to access the same kind of pages stored in different folders.