

<p>First, get your section. The following code will return you a <a href="http://buildwithcraft.com/docs/templating/sectionmodel">SectionModel</a>:</p>

<pre class="lang-twig prettyprint-override"><code>{% set section = craft.sections.getSectionByHandle('mySectionHandle') %}
</code></pre>

<p>Next, get the Entry Types off it. This will return you an array of <a href="http://buildwithcraft.com/docs/templating/entrytypemodel">EntryTypeModel</a> objects:</p>

<pre class="lang-twig prettyprint-override"><code>{% set entryTypes = section.getEntryTypes() %}
</code></pre>

<p>From there you can loop through them to create your nav:</p>

<pre class="lang-twig prettyprint-override"><code>{% for entryType in entryTypes %}
    &lt;a href="{{ url('types/'~entryType.handle) }}"&gt;{{ entryType.name }}&lt;/a&gt;
{% endfor %}
</code></pre>

<p>You’ll want to create a <a href="http://buildwithcraft.com/docs/routing#dynamic-routes">Route</a> which accepts those dynamic URLs (e.g. <code>types/(slug)</code>), and point it to a template like “types/_type.html”.</p>

<p>From that _type template, you can fetch entries of the requested type like this:</p>

<pre class="lang-twig prettyprint-override"><code>{% set type = craft.request.getSegment(2) %}
{% set entries = craft.entries.type(type) %}
</code></pre>

CC BY-SA 3.0
2014-08-06T15:00:33.067Z
Ah brilliant, I knew it couldn't be hard. Thanks!
Shane Hudson
CC BY-SA 3.0
2014-08-06T15:01:57.310Z
Oh wait actually, doesn't that find entries of a type? Instead of the avaiable entry types themselves. Ie. I need a list to Books, Films, Notes etc
Shane Hudson
CC BY-SA 3.0
2014-08-06T15:15:25.387Z
I do apologise, completely missed your point - have updated with what I think you're after and am off hunting down some relevant docs if I can find them...
Josh Angell
CC BY-SA 3.0
2014-08-06T15:17:25.790Z
@joshangell beat me to it :)
Brandon Kelly
CC BY-SA 3.0
2014-08-06T15:19:03.630Z
@BrandonKelly proper facepalm moment for me there...
Josh Angell
CC BY-SA 3.0
2014-08-06T15:26:38.787Z
@ShaneHudson Just updated the answer to also show how to create the nav, and make it work.
Brandon Kelly
CC BY-SA 3.0
2014-08-06T15:39:38.520Z
@BrandonKelly you should totally get the points for that one!
Josh Angell
CC BY-SA 3.0
2014-08-06T15:48:04.183Z
@joshangell haha, I’ve got enough points :)
Brandon Kelly
CC BY-SA 3.0
2014-08-06T14:56:39.473Z
2014-08-06T15:26:17.240Z
2014-08-06T15:26:17.240Z
Josh Angell
<p>If I were to have entries of types: Book, Film, Note, Post and Bookmark. How would I automatically create a list of links (or a filter) to each entry type?</p>

<templating><navigation>
How Do You Create A Navigation Of Entry Types?
# How Do You Create A Navigation Of Entry Types?

(Asked by: username_0 on 2014-08-06)

If I were to have entries of types: Book, Film, Note, Post and Bookmark. How would I automatically create a list of links (or a filter) to each entry type?

**Tags:** templating, navigation


---

## 1 answers

### Answer by username_1 on 2014-08-06. Score: 7 | Accepted answer

First, get your section. The following code will return you a SectionModel:
{% set section = craft.sections.getSectionByHandle('mySectionHandle') %}

Next, get the Entry Types off it. This will return you an array of EntryTypeModel objects:
{% set entryTypes = section.getEntryTypes() %}

From there you can loop through them to create your nav:
{% for entryType in entryTypes %}
    {{ entryType.name }}
{% endfor %}

You’ll want to create a Route which accepts those dynamic URLs (e.g. types/(slug)), and point it to a template like “types/_type.html”.
From that _type template, you can fetch entries of the requested type like this:
{% set type = craft.request.getSegment(2) %}
{% set entries = craft.entries.type(type) %}

> **Comments:**
> **username_0**: Ah brilliant, I knew it couldn't be hard. Thanks!  
> **username_0**: Oh wait actually, doesn't that find entries of a type? Instead of the avaiable entry types themselves. Ie. I need a list to Books, Films, Notes etc  
> **username_1**: I do apologise, completely missed your point - have updated with what I think you're after and am off hunting down some relevant docs if I can find them...  
> **username_2**: @joshangell beat me to it :)  
> **username_1**: @BrandonKelly proper facepalm moment for me there...  
> **username_2**: @ShaneHudson Just updated the answer to also show how to create the nav, and make it work.  
> **username_1**: @BrandonKelly you should totally get the points for that one!  
> **username_2**: @joshangell haha, I’ve got enough points :)  

---

