---
title: How to use tags?
layout: page
date: 2015-12-05
---

Urubu supports tags. To use them, you need 2 things:

* Assign the desired tags to content pages, by assigning a tag or
a list of tags to the `tags` attribute.  See also: 
[/manual/structure#Content files].

* Provide a `tag.html` layout in the `_layouts` directory. 

It is the existence of the `tag.html` layout that triggers the generation of
tag-related content. For example, if you have used tags `bar` and `foo` in the
project, you will see that the `_build` folder contains `tag/bar/index.html`
and `tag/foo/index.html`. Those index files use the `tag.html` layout to show 
the content related to a tag.

Presumably, there is already a general `index.html` layout to show content in a
folder. An initial `tag.html` layout can then be a one-liner by using template
inheritance, like so: 

```
{% raw %}
{% extends "index.html" %}
{% endraw %}
```

Of course, you may want to specialize the `tag.html` layout
further to better reflect the purpose.

Urubu also generates the corresponding tag objects so that you can use them in
your layouts. This is described in [/manual/templates#Tag objects].

Note that the `_build` will contain a top-level `tag` folder, even when the
source directory does not. Optionally, you can define the `tag` folder in the
source also.  You can then define an index file and set attributes such as the
`layout` to display the tags themselves.  However, the content will be
generated by Urubu automatically and needs not be set. See also: 
[/manual/templates#Tag folder object].

