Answers.Body: <p>You can have entry type specific templates for your <em>entry pages</em>, see this <a href="http://buildwithcraft.com/help/entry-type-templates" rel="nofollow">docs article</a> on how you can do this. And for your <em>archive pages</em>, just set a route for each of them and point it to the corresponding index/listings template.</p>
  
  <p>So basically you end up with something like this for your entries:</p>
  
  <ul>
  <li>media/_entry.html (example.com/2014/01/01/example-entry)</li>
  <li>media/_types/audio.html (included in _entry.html if entry type is audio)</li>
  <li>media/_types/video.html (included in _entry.html if entry type is video)</li>
  <li>...</li>
  </ul>
  
  <p>and this for your archive pages:</p>
  
  <ul>
  <li>media/index.html (example.com/2014/01/01/ etc.)</li>
  <li>media/audio/index.html (example.com/audio/)</li>
  <li>media/video/index.html (example.com/video/)</li>
  <li>...</li>
  </ul>
  
  <p>If you don't want to set new routes for the entry type specific archive pages you can also put the templates in a folder whose index.html template file is called automatically if no route exists (eg. audio/index.html for example.com/audio/).</p>
  
  <p>Additionally I'd make good use of include and extend in these templates to make this as DRY and easy to maintain as possible.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T16:53:52.287Z
Answers.Text: Ignore my comment. re-reading with update.
Answers.UserDisplayName: cballenar
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T17:00:56.643Z
Answers.Text: Haha, sorry, I got pretty confused. I'm not sure I'm following your suggestion but I'm gonna try it and get back. Thanks!
Answers.UserDisplayName: cballenar
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T17:17:14.710Z
Answers.Text: Ok, I see what you're saying now. Yes, that's actually the approach I'm taking at the moment. However since I have 12 entry types, this becomes cumbersome to set up and maintain if anything changes, especially when I need to get the type name and handle, and try to keep it consistent with URLs. See this other question I posted: http://craftcms.stackexchange.com/questions/772/entry-types-custom-slug It's possible to do it this way, but it seems like there should be an easier way of handling it. Wouldn't you think?
Answers.UserDisplayName: cballenar
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T17:22:00.633Z
Answers.Text: @cballenar I don't see the problem you have with this. In case you want to add entry types, all you have to do is to add a new archive template and a new entry template. If these templates are very similar you can always work with include / extend.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T17:25:34.627Z
Answers.Text: @cballenar if you don't want to set new routes for the entry type specific archive pages you can also put the templates in a folder that is called automatically if no route exists (eg. audio/index.html for example.com/audio/).
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T17:39:48.823Z
Answers.Text: Yeah, part of the problem was having to create different routes. If I had another section with even more types (I don't intend to) it would feel like a bad practice having to create a route for each. I don't have a problem with different templates, they are necessary since most of these types will look different from each other. But yeahhh... I think I'll just have to do it this way.
Answers.UserDisplayName: cballenar
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T17:45:06.680Z
Answers.Text: @cballenar see my edit / last comment on how to avoid setting up routes. You only need routes for example.com/2014/01/01/, example.com/2014/01/ and example.com/2014/ all the other templates can do with folder structure and index.html alone.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T16:29:45.487Z
Answers.LastActivityDate: 2014-07-11T17:42:38.320Z
Answers.LastEditDate: 2014-07-11T17:42:38.320Z
Answers.UserDisplayName: carlcs
Body: <p>I would like to create a route for the entry types of a specific section, pointing to a single template. </p>
  
  <p>Is it possible to do this automatically? So far I haven't had luck, I'm thinking something like this:</p>
  
  <ul>
  <li>route = /{ mysection.type }</li>
  <li>template = type/index.twig</li>
  </ul>
  
  <p>Or would I need to create a route for each entry type and all of them pointing to same template?</p>
  
  <ul>
  <li>route 1 = /entryType1</li>
  <li>route 2 = /entryType2</li>
  <li>route 3 = /entryType3</li>
  <li>shared template = type/index.twig</li>
  </ul>
  
  <p>The reason I would like to do it this way, as opposed to how it has been shown before, <a href="http://buildwithcraft.com/help/entry-type-urls" rel="nofollow">here</a>; is because I would like to keep all the URL's with a date format, i.e.: <em>example.com/2014/07/11/slug</em> so that I can then implement an archive template. But I still need a way to filter by entry types (a total of 12 types). So that at the end of the day I end up with URLs like these ones:</p>
  
  <ul>
  <li>example.com/2014/01/01/<strong>example-entry</strong> - URL for Example Entry</li>
  <li>example.com/<strong>2014/01/01/</strong> - URL for listing entries from day</li>
  <li>example.com/<strong>2014/01/</strong> - URL for listing entries from month</li>
  <li>example.com/<strong>2014/</strong> - URL for listing entries from year</li>
  <li>example.com/<strong>video/</strong> - URL for Video types of entry</li>
  <li>example.com/<strong>audio/</strong> - URL for Audio types of entry</li>
  </ul>
  
  <p>Any suggestions on how to solve this?</p>
  
Tags: <entry-type><routes>
Title: New route for entry types
ThreadText: # New route for entry types
  
  (Asked by: username_0 on 2014-07-11)
  
  I would like to create a route for the entry types of a specific section, pointing to a single template.
  
  Is it possible to do this automatically? So far I haven't had luck, I'm thinking something like this:
  
  * route = /{ mysection.type }
  * template = type/index.twig
  
  Or would I need to create a route for each entry type and all of them pointing to same template?
  
  * route 1 = /entryType1
  * route 2 = /entryType2
  * route 3 = /entryType3
  * shared template = type/index.twig
  
  The reason I would like to do it this way, as opposed to how it has been shown before, [here](http://buildwithcraft.com/help/entry-type-urls); is because I would like to keep all the URL's with a date format, i.e.: *example.com/2014/07/11/slug* so that I can then implement an archive template. But I still need a way to filter by entry types (a total of 12 types). So that at the end of the day I end up with URLs like these ones:
  
  * example.com/2014/01/01/**example-entry** - URL for Example Entry
  * example.com/**2014/01/01/** - URL for listing entries from day
  * example.com/**2014/01/** - URL for listing entries from month
  * example.com/**2014/** - URL for listing entries from year
  * example.com/**video/** - URL for Video types of entry
  * example.com/**audio/** - URL for Audio types of entry
  
  Any suggestions on how to solve this?
  
  **Tags:** entry-type, routes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-07-11. Score: 5 | Accepted answer
  
  You can have entry type specific templates for your *entry pages*, see this [docs article](http://buildwithcraft.com/help/entry-type-templates) on how you can do this. And for your *archive pages*, just set a route for each of them and point it to the corresponding index/listings template.
  
  So basically you end up with something like this for your entries:
  
  * media/\_entry.html (example.com/2014/01/01/example-entry)
  * media/\_types/audio.html (included in \_entry.html if entry type is audio)
  * media/\_types/video.html (included in \_entry.html if entry type is video)
  * ...
  
  and this for your archive pages:
  
  * media/index.html (example.com/2014/01/01/ etc.)
  * media/audio/index.html (example.com/audio/)
  * media/video/index.html (example.com/video/)
  * ...
  
  If you don't want to set new routes for the entry type specific archive pages you can also put the templates in a folder whose index.html template file is called automatically if no route exists (eg. audio/index.html for example.com/audio/).
  
  Additionally I'd make good use of include and extend in these templates to make this as DRY and easy to maintain as possible.
  
  > **Comments:**
  > **username_0**: Ignore my comment. re-reading with update.  
  > **username_0**: Haha, sorry, I got pretty confused. I'm not sure I'm following your suggestion but I'm gonna try it and get back. Thanks!  
  > **username_0**: Ok, I see what you're saying now. Yes, that's actually the approach I'm taking at the moment. However since I have 12 entry types, this becomes cumbersome to set up and maintain if anything changes, especially when I need to get the type name and handle, and try to keep it consistent with URLs. See this other question I posted: http://craftcms.stackexchange.com/questions/772/entry-types-custom-slug It's possible to do it this way, but it seems like there should be an easier way of handling it. Wouldn't you think?  
  > **username_1**: @username_0 I don't see the problem you have with this. In case you want to add entry types, all you have to do is to add a new archive template and a new entry template. If these templates are very similar you can always work with include / extend.  
  > **username_1**: @username_0 if you don't want to set new routes for the entry type specific archive pages you can also put the templates in a folder that is called automatically if no route exists (eg. audio/index.html for example.com/audio/).  
  > **username_0**: Yeah, part of the problem was having to create different routes. If I had another section with even more types (I don't intend to) it would feel like a bad practice having to create a route for each. I don't have a problem with different templates, they are necessary since most of these types will look different from each other. But yeahhh... I think I'll just have to do it this way.  
  > **username_1**: @username_0 see my edit / last comment on how to avoid setting up routes. You only need routes for example.com/2014/01/01/, example.com/2014/01/ and example.com/2014/ all the other templates can do with folder structure and index.html alone.  
  
  ---
  
  