# Taxonomy

Taxonomy terms are grouped into taxonomies and are fetched and filtered by this tag. A taxonomy could contain tags, categories, or sock colors.

## Example {#example}


A basic example would be to loop through the terms in a tags taxonomy and link to each individual tag:


::tabs

::tab antlers
```antlers
<ul>
{{ taxonomy from="tags" }}
    <li><a href="{{ url }}">{{ title }}</a></li>
{{ /taxonomy }}
</ul>
```
::tab blade
```blade
<ul>
<s:taxonomy from="tags">
  <li><a href="{{ $url }}">{{ $title }}</a></li>
</s:taxonomy>
</ul>
```
::

You can also use the shorthand syntax for this. We prefer this style ourselves.

::tabs

::tab antlers
```antlers
<ul>
{{ taxonomy:tags }}
    <li><a href="{{ url }}">{{ title }}</a></li>
{{ /taxonomy:tags }}
</ul>
```
::tab blade
```blade
<ul>
<s:taxonomy:tags>
  <li><a href="{{ $url }}">{{ $title }}</a></li>
</s:taxonomy:tags>
</ul>
```
::

If you'd like to fetch tags from multiple taxonomies, you'll need to use the standard syntax.

::tabs

::tab antlers
```antlers
{{ taxonomy from="tags|categories" }}
```
::tab blade
```blade
<s:taxonomy from="tags|categories">

</s:taxonomy>
```
::

To get terms from _all_ taxonomies, use the wildcard `*`. You may also exclude taxonomies when doing this.

::tabs

::tab antlers
```antlers
{{ taxonomy from="*" not_from="tags" }}
```
::tab blade
```blade
<s:taxonomy from="*" not_from="tags">

</s:taxonomy>
```
::

## Entries

The `taxonomy` tag allows you to iterate over taxonomy terms, but in each iteration, you also have access to all the corresponding content.

::tabs

::tab antlers
```antlers
{{ taxonomy:categories }}
  <h2>{{ title }}</h2>
  <ul>
    {{ entries }}
      <li><a href="{{ url }}">{{ title }}</a></li>
    {{ /entries }}
  </ul>
{{ /taxonomy:categories }}
```
::tab blade
```blade
<s:taxonomy:categories>
  <h2>{{ $title }}</h2>
  <ul>
    @foreach ($entries as $entry)
      <li><a href="{{ $entry->url }}">{{ $entry->title }}</a></li>
    @endforeach
  </ul>
</s:taxonomy:categories>
```
::

```html
<h2>News</h2>
<ul>
  <li><a href="/blog/breaking">A breaking story!</a></li>
  <li><a href="/blog/so-interesting">An interesting article</a></li>
</ul>

<h2>Events</h2>
<ul>
  <li><a href="/events/walk-in-the-park">A walk in the park</a></li>
  <li><a href="/events/summer-camp">Summer camp</a></li>
</ul>
```

You're free to use filtering or sorting parameters on the `entries` pair that you'd find on the [collection tag](/tags/collection.md).

> To use the `entries` tag, the Taxonomy must already be [attached to the Collection](/taxonomies.md#collections).

## Filtering

There are a couple of ways to filter your taxonomy terms. There's the conditions syntax for filtering by fields, or the custom filter class if you need extra control.

### Conditions

Want to get entries where the title has the words "awesome" and "thing", and "joe" is the author? You can write it how you'd say it:

::tabs

::tab antlers
```antlers
{{ taxonomy:tags title:contains="awesome" title:contains="thing" author:is="joe" }}
```
::tab blade
```blade
<s:taxonomy:tags
  title:contains="awesome"
  title:contains="thing"
  author:is="joe"
>
</s:taxonomy:tags>
```
::

There are a bunch of conditions available to you, like `:is`, `:isnt`, `:contains`, `:starts_with`, and `:is_before`. There are many more than that. In fact, there's a whole page dedicated to [conditions - check them out][conditions].


### Custom Query Scopes

Doing something custom or complicated? You can create [query scopes](/extending/query-scopes-and-filters.md) to narrow down those results.



[conditions]: /conditions
[custom_filters]: /addons/classes/filters
