@lukasbestle: You are right, there are, in fact, a few related topics, e.g. querying a structure field. That’s why an official feature would be great. But unfortunately, we cannot always sit and wait for a feature if we have to get a project out into the world
I’ve tried to use your example to fetch all the tags of all the site pages, but I’m struggling to traverse all the pages of the site: foreach(kirby()->site()->tags()->split() as $allmytags)
return only the tags from the ‘site.txt’ file
foreach(kirby()->site()->pages()->tags()->split() as $allmytags)
return a null error
foreach(kirby()->site()->page()->tags()->split() as $allmytags)
return only the ‘home.txt’ content (which is a starterkit content for now)
How can I traverse all the pages of the site within a custom select field in order to fetch all the fields tags ?
So, that would be generating a JSON array and populating it with all tags on the page ( something like this: foreach ($page->index()->tags()->split as $globalTags), right? So, basically for tags that would ‘only’ be their title, or am I mistaken?
// Edit: While I’m on it: Is it possible to (automatically) create a subpage for each tag, with a URL like example.com/tags/individual-tag … I don’t especially like the tag:individual-tag structure from the docs …
No, you can’t use parameters in the route, that will be ignored, this should work the other way round, i.e. the route pattern should be the URL that you want to have, like tags/some_tag and then the action returns whatever you want to return from that route, i.e. a filtered collection.