Skip to the content

Tags and Umbraco 8

When I was working on a site, I had a document type that uses the Tag Property Editor. The Tags property editor allows you to add multiple tags to a node. The document type I was using it on was a blog article and tags are used to categories each blog post. 

In the past, I have used Composers, Interfaces, Controllers and RelationTypes to make a dropdown menu for unique categories but this is when I have a used a content picker. The issue I had with using the Tag Property type is there is no unique id associated to the tag. It's just a string of text.

I tried a number of different ways to get the RelationType to work but thankfully, my google skills came up with a great bit of documentation. 

What I needed to do was make a new unique Data Type using the Property editor Tags, give it a unique Tag Group name.


Once this is created, I can then use it on a Document Type. 

Now, this is the clever part. 

There is an Umbraco Helper which you can use to query all your content by the Tag Group. The documentation shows a couple of examples.

I used it like so: 

No need for any crazy coding, just use the TaqQuery to get all the tags. 

This pulls all tags used and outputs them in to a dropdown menu and it's really quick. 

I hope it helps someone.

About the author



Owain is an Umbraco MVP, an Umbraco certified master and works on Umbraco projects on a daily basis. When not coding, he enjoys running, spending time with his wife and building lego! 

He is also a GitKraken ambassador and helps look after the website.

comments powered by Disqus