Answers.Body: <p>Yes, it is possible.</p>
  
  <p>Pass the entry type handle to a segment and access that segment using the <code>craft.request</code> <a href="http://buildwithcraft.com/docs/templating/craft.request#getSegment" rel="nofollow"><code>getSegment()</code></a> method. Use this segment variable with the <code>craft.entries</code> <a href="http://buildwithcraft.com/docs/templating/craft.entries#type" rel="nofollow"><code>.type()</code></a> method to fetch only the entries of the given type. The example below assumes your entry type handle is in segment 2.</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set entries = craft.entries.section('pages').type(craft.request.getSegment(2)) %}
  
  {% for entry in entries %}
      &lt;li&gt;{{ entry.title }}&lt;/li&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-24T18:40:41.883Z
Answers.Text: Would I need to set up a route in order to tell craft to use the template from the first segment? When I add another segment to the url I get a 404 error.
Answers.UserDisplayName: Jesse Bennett-Chamberlain
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-24T19:41:44.370Z
Answers.Text: Great point. If the URL that loads the template is tied to a Single or Section entry, yes, you should define a route.
Answers.UserDisplayName: Alex Kendrick
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-21T13:57:36.043Z
Answers.LastActivityDate: 2014-06-24T14:39:43.793Z
Answers.LastEditDate: 2014-06-24T14:39:43.793Z
Answers.UserDisplayName: Alex Kendrick
Body: <p>I'm wondering if it's possible to dynamically filter a section list by entry type based on a url segment?</p>
  
  <p>I'm hoping to avoid assigning a category to every entry.</p>
  
Tags: <entry-type><best-practice>
Title: Is it possible to Filter entry types via the URL?
ThreadText: # Is it possible to Filter entry types via the URL?
  
  (Asked by: username_0 on 2014-06-21)
  
  I'm wondering if it's possible to dynamically filter a section list by entry type based on a url segment?
  
  I'm hoping to avoid assigning a category to every entry.
  
  **Tags:** entry-type, best-practice
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-06-21. Score: 3 | Accepted answer
  
  Yes, it is possible.
  
  Pass the entry type handle to a segment and access that segment using the `craft.request` [`getSegment()`](http://buildwithcraft.com/docs/templating/craft.request#getSegment) method. Use this segment variable with the `craft.entries` [`.type()`](http://buildwithcraft.com/docs/templating/craft.entries#type) method to fetch only the entries of the given type. The example below assumes your entry type handle is in segment 2.
  
  ```twig
  {% set entries = craft.entries.section('pages').type(craft.request.getSegment(2)) %}
  
  {% for entry in entries %}
      <li>{{ entry.title }}</li>
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Would I need to set up a route in order to tell craft to use the template from the first segment? When I add another segment to the url I get a 404 error.  
  > **username_1**: Great point. If the URL that loads the template is tied to a Single or Section entry, yes, you should define a route.  
  
  ---
  
  