Creating & Using Tag Fields
The following steps will help you get started with creating and using Tag fields and implementing groups for multiple Tag fields.
1) Creating a Tag Field
- Go to the Channel Manager area in the CP. Click on Field Groups nav item on left, and under the applicable Field Group, select Fields button.
- At top right, click the Create New button.
- For the Type option, select Tag from the list.
- Name the field as you wish - for example Tag Relationship with short name of tag_relationship. DO NOT name your field tag, as that is a reserved variable name for Tag.
- Scroll down to Field Options area of the page.
- For Tag Group field, select the a group from the list, or create a new one by clicking the Insert New Tag Group button.
- In the All Open field, select Yes or No. Yes means that by default, the Top Tags and Suggest Tags features will show in the Publish page. Selecting No means they will not show, but a button representation for these can still be clicked to show those features.
- In the Autocomplete, Suggest and Top Tags from field, select All Groups or This Group. Selecting All Groups means that tags from all groups will show for auto-suggest Add Tags, Suggest and Top Tags features. Selecting This Group means that only tags from the group will display across the respective Tag features.
- In the Top Tags Limit field, enter in the maximum number of Top Tag suggestions you'd like to show for this Tag field.
- Click Save Field button to save the new custom field.
- If you wish to create more Tag fields, just follow the procedure above again.
2) Understanding Tag Groups
Tag allows you to create as many Tag fields as you wish. In doing so, you can have different sets (groups) of tags in your system. This means that in your pages you can show different lists of tags in the system, when you filter it down by a specific Tag group. It also means that you can do other things like view entries that contain a specific tag for either any Tag field, or for a specific Tag field.
As mentioned above, you must assign a Tag group to each Tag field you have. The reason you must assign Tag groups and call those in templates instead just calling the Tag field name is for flexibility. It's very likely that your site may have multiple channels, and each channel might have a different custom field group assigned to it. In that case, you would have to create a Tag field for each of those groups (if you want tagging for each channel), but you might want them all to be in the same Tag group. In this case, you would just keep assigning each Tag field to the same Tag group.
3) Assigning Tags to Entries
- Go to the Publish area in the CP. If the field group the Tag field belongs to is assigned to the channel you selected, you should now see the special Tag field.
- To add tags, simply type a name of a tag in the input field and hit Enter.
- When existing tags are assigned to other entries, you might start to see the input field start auto-suggesting some other tags that start with the letters you've started typing. Just use the down arrow (or use mouse to click on) to select one of those suggestions and hit Enter.
- If other tags exist in the system, you can click on the button that appears to look like a "refresh" icon beside the Suggest Tags label to have Tag look through all of your custom fields for the current entry and see if any words match existing tags in the system. Those suggestions can then be clicked to assign them to the current entry.
- The Top Tags line will display the top tags. You can click on any of those tags to assign them to the current entry.
- To remove any tags that are assigned to an entry, simply click the X beside the tag where the currently assigned tags are (right below the input field).
Suggest Tags and Top Tags areas hidden (but can be shown by clicking the buttons):
Tag field auto-suggests other existing tags as you type a tag name:
And you can use as many Tag fields as you wish!
4) Removing a Tag Field
If you wish you delete a Tag field, simply delete it the same way you would any other custom field. If you'd like a Tag field to no longer have the special Tag functionality (tag widget, etc), but would like to retain all of the existing tags as text for that field, simply change the field type from Tag to Text Input. This will remove those tags from the Tag database, but will retain the tag values in the custom field for the entries that contain that field and Tag data.