---
title: Tags
audience: writer, designer
tags: [navigation]
last_updated: July 16, 2016
keywords: tags, navigation, buttons, links, association
summary: "Tags provide another means of navigation for your content. Unlike the table of contents, tags can show the content in a variety of arrangements and groupings. Implementing tags in this Jekyll theme is somewhat of a manual process."
sidebar: mydoc_sidebar
permalink: mydoc_tags.html
folder: mydoc
---
## Add a tag to a page
You can add tags to pages by adding `tags` in the frontmatter with values inside brackets, like this:
```
---
title: 5.0 Release Notes
permalink: release_notes_5_0.html
tags: [formatting, single_sourcing]
---
```
## Tags overview
{% include note.html content=" With posts, tags have a namespace that you can access with posts.tags.tagname
, where tagname
is the name of the tag. You can then list all posts in that tag namespace. But pages don't off this same tag namespace, so you could actually use another key instead of tags
. Nevertheless, I'm using the same tags
approach for posts as with pages." %}
To prevent tags from getting out of control and inconsistent, first make sure the tag appears in the \_data/tags.yml file. If it's not there, the tag you add to a page won't be read. I added this check just to make sure I'm using the same tags consistently and not adding new tags that don't have tag archive pages.
{% include note.html content="In contrast to WordPress, with Jekyll to get tags on pages you have to build out the functionality for tags so that clicking a tag name shows you all pages with that tag. Tags in Jekyll are much more manual." %}
Additionally, you must create a tag archive page similar to the other pages named tag_{tagname}.html folder. This theme doesn't auto-create tag archive pages.
For simplicity, make all your tags single words (connect them with hyphens if necessary).
## Setting up tags
Tags have a few components.
1. In the \_data/tags.yml file, add the tag names you want to allow. For example:
```json
allowed-tags:
- getting_started
- overview
- formatting
- publishing
- single_sourcing
- special_layouts
- content types
```
3. Create a tag archive file for each tag in your tags_doc.yml list. Name the file following the same pattern in the tags folder, like this: tag_collaboration.html.
Each tag archive file needs only this:
{% raw %}
```liquid
---
title: "Collaboration pages"
tagName: collaboration
search: exclude
permalink: tag_collaboration.html
sidebar: mydoc_sidebar
---
{% include taglogic.html %}
```
{% endraw %}
{% include note.html content="In the \_includes/mydoc folder, there's a taglogic.html file. This file (included in each tag archive file) has common logic for getting the tags and listing out the pages containing the tag in a table with summaries or truncated excerpts. You don't have to do anything with the file — just leave it there because the tag archive pages reference it." %}
4. Change the title, tagName, and permalink values to be specific to the tag name you just created.
By default, the \_layouts/page.html file will look for any tags on a page and insert them at the bottom of the page using this code:
```liquid
{% raw %}