I think there is not such an option atm.
Also it would open up some questions: What if your tags field isn’t actually called ‘tags’? What if you use a different separator than ‘,’?
That needs to go into /site/fields, in this case into a folder “category”, because that is the name of the field. If you change the name of the field, you also need to change its folder name.
@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
Hi,
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 ?
Sorry, it’s been a while, but I am still looking for a way with select / multiselect (using @distantnative’s plugin) fields to choose from all tags there are. Any suggestions as of 11/17?
Thanks very much and sorry for reviving this old post, but posting a duplicate would be worse
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.