<p>You could have a try with <a href="https://craftcms.com/docs/routing#dynamic-routes" rel="nofollow noreferrer">dynamic routing</a>, where you map a URL (or a url pattern) to a specific template. </p>

<p>Dynamic routes take priority over template paths. </p>

<p>If I misunderstood you, can you give an example as to what the URL is for a specific entry compared to what you need it to be?</p>

CC BY-SA 3.0
2017-07-19T16:10:18.673Z
I had tried a few stabs at dynamic routing but must had an error in the regex. Now, with the regex set to `our-firm/(?P<type>[^\/]+)/(?P<slug>[^\/]+)`  it's calling up the template. So, in the routes.php, it's `'our-firm/(?P<type>[^\/]+)/(?P<slug>[^/]+)' => 'path-to/template'` which calls the right template when visiting /our-firm/kebabed-entry-type-name/url-slug. Thanks for encouraging me to revisit the approach. I'm running into an issue where the page is reporting the variable 'slug' does not exist, but as soon as I figure out the error, I'll fix the question here.
Shanan Galligan
CC BY-SA 3.0
2017-07-19T16:15:09.107Z
Note, the template does set the entry with `{% set entry = craft.entries.section('mySectionHandle').slug(slug).first() %}` per the method outlined here: https://craftcms.stackexchange.com/questions/8209/subtemplates-for-entry-using-routing/8217
Shanan Galligan
CC BY-SA 3.0
2017-07-19T06:56:17.043Z
2017-07-19T06:56:17.043Z
mrsmn
<p>I have a section that has multiple entry types. I would like to use kebab-style url segments in the URL format. I can get the articles to serve kebab URIs using this for the section's Entry URL Format: </p>

<pre><code>our-firm/{type.name|kebab}/{slug}
</code></pre>

<p>However, this will not call the template when making the page call — needs to be: </p>

<pre><code>our-firm/{type}/{slug}
</code></pre>

<p>So, how do you set things up to have the best of both worlds: kebab'd url segments and working templates?</p>

<routes><segments>
Custom routes using kebab {type} in URL segment
# Custom routes using kebab {type} in URL segment

(Asked by: username_0 on 2017-07-18)

I have a section that has multiple entry types. I would like to use kebab-style url segments in the URL format. I can get the articles to serve kebab URIs using this for the section's Entry URL Format: 
our-firm/{type.name|kebab}/{slug}

However, this will not call the template when making the page call — needs to be: 
our-firm/{type}/{slug}

So, how do you set things up to have the best of both worlds: kebab'd url segments and working templates?

**Tags:** routes, segments

---

## 1 answers

### Answer by username_1 on 2017-07-19. Score: 1

You could have a try with [dynamic routing](https://craftcms.com/docs/routing#dynamic-routes), where you map a URL (or a url pattern) to a specific template.

Dynamic routes take priority over template paths.

If I misunderstood you, can you give an example as to what the URL is for a specific entry compared to what you need it to be?

> **Comments:**
> **username_0**: I had tried a few stabs at dynamic routing but must had an error in the regex. Now, with the regex set to `our-firm/(?P<type>[^\/]+)/(?P<slug>[^\/]+)`  it's calling up the template. So, in the routes.php, it's `'our-firm/(?P<type>[^\/]+)/(?P<slug>[^/]+)' => 'path-to/template'` which calls the right template when visiting /our-firm/kebabed-entry-type-name/url-slug. Thanks for encouraging me to revisit the approach. I'm running into an issue where the page is reporting the variable 'slug' does not exist, but as soon as I figure out the error, I'll fix the question here.  
> **username_0**: Note, the template does set the entry with `{% set entry = craft.entries.section('mySectionHandle').slug(slug).first() %}` per the method outlined here: https://craftcms.stackexchange.com/questions/8209/subtemplates-for-entry-using-routing/8217  

---

