How to loop via a specific type of page/blueprint

Forgive me for this question but it seems the kind of thing that is so obvious I can’t seem to find anything on it and the docs are not helping me.

I have a few blueprints: artist, event, default.

I used the starter kit as a guideline to create this as well as sample blueprints from the Kirby docs. I’m using the plain kit as a base.

I’m trying to access
1 - all the pages on my Kirby website
2 - all the pages belonging to a specific “type” (blueprint)

{% for child in site.children() %}
  <li><a href="{{ child.url }}">{{ child.title }}</a></li>
{% endfor %}

This will only give me two pages: Error and Home. I’ve read up on Kirby’s query language and tried multiple examples including things like site.children.listed.template('artist') which shows nothing at all.

I’m templating using Twig which might add to the confusion but it’s almost 10 years since I used “pure” PHP.

The twig {{ dump() }} doesn’t seem to work with Kirby (I’ve read a post on this issue I can’t find again) so I’ve been trying to check what I can access via {{ site.children()|json_encode(constant('JSON_PRETTY_PRINT')) }} but I guess I’m missing something because all I get is null or, in this case, the confusing

{ "data": { "error": { "content": {}, "translations": null, "children": null, "drafts": null, "childrenAndDrafts": null }, "home": { "content": {}, "translations": null, "children": null, "drafts": null, "childrenAndDrafts": null } } }

So any help on debugging with Twig would be appreciated. I think I’m missing something about the overall structure of Kirby which I can’t seem to get right even going through the Docs.

$site->children() only gets first level pages, i.e. those that site directly in the content folder.

If you want to get all pages on all levels, use $site->index(), to filter them by acutally used template $site->index()->template('xyz'), to filter them by intendedTemplate $site->index()->filterBy('intendedTemplate', 'xyz').

Using $site->index() can slow your site down if you have many pages.

I seemed to have found out the culprit, which has something to do with my (local) environment. The pages weren’t moving from the _drafts folder even though they are set to be public. That’s something for another time, I guess, and for now I just moved them manually and site.index().template('artist') works perfectly.

Thank you so much!