Tags
Alias: Umbraco.Tags
Returns: IEnumerable<string>
The Tags property editor allows you to add multiple tags to a node.
Data Type Definition Example
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F2945122355-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmmtM2UdX1OOMSi0CksPv%252Fuploads%252Fgit-blob-28df576cc6626759fad377cc7acfd95e6c611c34%252FTags-DataType-v10.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=ff8f70cf&sv=1)
Tag group
The Tag group setting provides a way to categorize your tags in groups. So for each category you will create a new instance of the Tags property editor and setup the unique category name for each instance. Whenever a tag is added to an instance of the tags property editor it's added to the tag group, which means it will appear in the Typeahead list when you start to add another tag. Only tags that belong to the specified group will be listed. If you have a "Frontend" group and a "Backend" group the tags from the "Frontend" group will only be listed if you're adding a tag to the Tags property editor configured with the "Frontend" group name and vice versa.
Storage type
Data can be saved in either Comma-Separated Values (CSV) format or in JSON format. By default data is saved in JSON format. The difference between using CSV and JSON is that with JSON you can save a tag, which includes comma separated values.
There are built-in property value converters, which means you don't need to worry about writing them yourself or parse the JSON output when choosing "JSON" in the storage type field. Therefore the last code example on this page will work out of the box without further ado.
Content Examples
CSV tags
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F2945122355-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmmtM2UdX1OOMSi0CksPv%252Fuploads%252Fgit-blob-ad132be4a7ff2b45367988c3bd50fdd3ac1e628f%252FCsv-example-v8.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=b29ae0cd&sv=1)
JSON tags
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F2945122355-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmmtM2UdX1OOMSi0CksPv%252Fuploads%252Fgit-blob-509f6bc80d876cd4d49dca91c119034e08dfd487%252FJson-example-v8.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=5679fce4&sv=1)
Tags typeahead
Whenever a tag has been added it will be visible in the typeahead when you start typing on other pages.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F2945122355-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmmtM2UdX1OOMSi0CksPv%252Fuploads%252Fgit-blob-36c7d8ab5602d4cc13ae2e6ab87750020195f316%252FTypeahead-v8.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=18747d30&sv=1)
MVC View Example - displays a list of tags
Multiple items - with Modelsbuilder
Multiple items - without Modelsbuilder
Setting Tags Programmatically
You can use the ContentService to create and update Umbraco content from c# code, when setting tags there is an extension method (SetTagsValue) on IContentBase that helps you set the value for a Tags property. Remember to add the using statement for Umbraco.Core.Models
to take advantage of it.
The example below demonstrates how to add values programmatically using a Razor view. However, this is used for illustrative purposes only and is not the recommended method for production environments.
Although the use of a GUID is preferable, you can also use the numeric ID to get the page:
If Modelsbuilder is enabled, you can get the alias of the desired property without using a magic string:
More on working with Tags
More on working with Tags (query all of them) can be found at the UmbracoHelper reference page
Last updated