Contentful logo

Contentful Community

All possible values of the field

I have a number of entries with a field that contains tags. Is there a way to get a list of all possible tag values, except parsing all the entries?

I’m trying to create a simple category picker and I want to present users with all possible options(tag values).

Hi Narviii,

if you are using a Symbol/Array field for these tags, then no, you had to go through all the entries (although you could try to create a smart query only giving you entries that actually contain tags).

Now, how about a different approach to tags? You could create a dedicated “Tag” Content Type. A tag would then be a link to an entry of this CT. Now you’d only have to query for all the entries of this Tag CT.

Best,
Daniel

I’m doing a smartquery from the frontend, but i somehow need to list all the possible tags for user to choose. Currently i made a workaround just by hardcoding all the possible tags.

Also what i can do is just maintain list of tags with some sort of script which fires upon new content beiining inserted, but this is not very elegant.

I’m just curious how this is solved usually, because it’s a pretty obvious task - get a list a tags which exist for the content, present user with the choice of them and filter based on his choice.

I have everything solved except getting list of tags.