I am running into an issue with a panel field.
I want to pluck tags from the whole site and display them as options in a tags field in the panel. I am almost there, but right now my tags are displayed as a list in one single tag. I would like to split them but cannot seem to make it work!
Here is what is see in the panel:
And here is my blueprint code:
fetch: site.children.pluck('tags', ',', true)
I hope someone can help me out, thanks in advance!
Hm, that field should actually work as is. Have you tried to clear the browser cache?
Yes I feel like I’ve tried everything!
Which Kirby version are you using? I put your field definition into a 188.8.131.52 Starterkit (only changing
index() because the Starterkit doesn’t have tags in the first level pages, and it works as expected.
Hi thanks for thinking along!
I’m on the same version: 184.108.40.206
If I inspect the tag it looks like this:
That looks very wrong. How are your tags stored in the content files? Are they really separated by a comma?
I have a page called ‘news’ which has a categories field
and i have a subpage of ‘news’ called ‘newsitem’. This subpage had a field called ‘tags’, where i can add tags, which are autocompleted from the parents’ field ‘categories’:
The tags field on page ‘newsitem’ looks like this:
Although this seems to work, it should be
page.parent.categories.split(','), don’t know why you have added
The tags field in the newsitem page looks fine. However, with
site.children.pluck('tags', ',', true) you won’t be able to fetch those, but would have to use
site.index.pluck('tags', ',', true).
site.children only refers to the first level pages.
Thanks for the
.index suggestion! This is working, it now autocomplets tags from ‘newsitem’ pages
What seems to happen is that the
site.index.pluck('tags', ',', true) interprets all the content of the categories field from the ‘news’ page as one tag. Is there no way to split this?
Maybe I just though of an alternative solution: Is there a way to store a collection of all the tags used in the site and query that file?
I think I am making it harder than it needs to be!
Right now I just use the query
site.index.pluck('tags', ',', true) on both the newsitem page and the homepage so all the tags that are used throughout the site are autocompleted. For me this is a solution to what I want to achieve!
Thanks a lot for your help @pixelijn!