Tags Field

Holds any number of tags, enabling relationships between content


  • Tag Group (optional) – The tag group tags will be selectable from.

  • Custom Label – A custom label users will see when adding tags to the field. Default is “Add Tag”, the word “Tag” is what will be replaced with your custom label.

  • Limit – How many tags can be selected.


When a user clicks the “Add Tag” or “Add {your custom label}” button a modal will popup allowing for the selection of a tag. If the restrict selection was set to a specific tag group then only tags in the tag group will be made available for selection.

If the tag the user wishes to select doesn't exist, they can create it by simply typing in the desired tag name into the search or create bar, and will be able to add it via the plus symbol button that appears on the right of the search or create bar.

A tag is then selected by clicking on it.

If the field has been set to required then the entry will not be update-able until at least one tag has been selected.

If the field has a limit set, then only that number of tags will be allowed to be selected. Once the limit has been reached the button to add more tags will disappear. If the limit is modified at a later date, and the field contains more than the new limit, an error will be shown notifying the user that they must remove tags from the field to match the new limit.

Template Use#

Access you tag fields via the handle you set for the field. Each tag field provides an array accessed via tagFieldHandle which contains the tags stored in the field, in the order set by the content creators.

{% set tags = entry.yourFieldHandle.tagFieldHandle %}

Each tag in the tagFieldHandle array is an instance of a \Enact\template\wrapper\Tag, which provides properties and methods for interfacing with each tag via your twig templates.


The loop

{% for tag in entry.yourFieldHandle.tagFieldHandle %}

    <p>{{ tag.name }} - Used {{ tag.usedTimes }} times</p>

{% endfor%}

Check if the field contains tags
{% if entry.yourFieldHandle.tagFieldHandle | length %}

    {{ entry.yourFieldHandle.tagFieldHandle[0].name }}

{% endif %}

//or test the 0 index of the array

{% if entry.yourFieldHandle.tagFieldHandle[0] %}

    {{ entry.yourFieldHandle.tagFieldHandle[0].getLinkHtml }}

{% endif %}

Another basic usage example

{% set tags = entry.yourFieldHandle.tagFieldHandle %}


{% for tag in tags %}

    <li><a href='{{ tag.entryUrl }}'>{{ tag.name }}</a></li>

{% endfor %}