<p>You can use twig filters in url structures as mentioned by RhealPoirier in a comment above, no need for a plugin:</p>

<pre><code>my-section/{type.handle|replace('/(^|[a-z])([A-Z])/', '\\1-\\2')|lower}/{slug}
</code></pre>

<p>or</p>

<pre><code>my-section/{type.name|kebab}/{slug}
</code></pre>

CC BY-SA 3.0
2016-08-24T23:41:42.813Z
2016-08-24T23:41:42.813Z
plankguy
<p>You can change the slug for the entry type to be whatever you want it to be. The one generated by Craft with the -'s is a default, not a requirement. Also there is a config setting, <a href="http://buildwithcraft.com/docs/config-settings#slugWordSeparator" rel="nofollow">slugWordSeparator</a> to control the default word separator.</p>

CC BY-SA 3.0
2014-07-06T17:45:00.570Z
From what I'm seeing now, entry types (not each entry, but the group of entry types) only have a 'name' and a 'handle'. This can be seen in the following screenshot.

https://www.dropbox.com/s/yirnzrc7dn7jfqn/Screenshot%202014-07-06%2012.42.26.png
cballenar
CC BY-SA 3.0
2014-07-07T10:59:37.527Z
entry type's don't have slugs and the handle cannot have dashes, although the name can.
Ben Croker
CC BY-SA 3.0
2014-07-06T17:30:28.003Z
2014-07-06T17:30:28.003Z
Marion Newlevant
<p>You could just set your "Entry URL Format" to:</p>

<pre><code>my-section/{type.name}/{slug}
</code></pre>

<p>Your entry type names couldn't be as clean when composing entries in the CP as you'd need to set them to something like "example-entry-type", but it would work.</p>

<hr>

<p>Now for the really clean way:</p>

<p>Install the <a href="https://github.com/low/low_regex/">Low Regex for Craft</a> plugin.</p>

<p>Set "Entry URL Format" to:</p>

<pre><code>my-section/{type.handle|regex('/(^|[a-z])([A-Z])/e', 'strtolower(strlen("\\1") ? "\\1-\\2" : "\\2")',(type.handle))}/{slug}
</code></pre>

<p>This will convert the entry type handle from camelCase to all lowercase with dashes as word delimiters. Set the entry type handles to be like "exampleEntryType" and they will become "example-entry-type" when in a slug.</p>

CC BY-SA 3.0
2015-02-26T16:17:53.697Z
I believe this is [native now](http://buildwithcraft.com/docs/templating/filters#replace).
Something like this may for for you.
`my-section/{ type.handle|replace('/(^|[a-z])([A-Z])/', '\\1-\\2')|lower }/{slug}`.
RhealPoirier
CC BY-SA 3.0
2014-07-07T00:07:20.890Z
Ahhh, I overlooked the usefulness of that plugin. I think I will go for that. It's a shame there's no native way of doing it but for now this is just as good.
Thanks a lot Simon!
cballenar
CC BY-SA 3.0
2014-07-07T02:04:57.303Z
No problem, glad it'll work for you!
Simon Kuran
CC BY-SA 3.0
2014-07-06T21:34:07.747Z
2014-07-06T21:49:12.633Z
2014-07-06T21:49:12.633Z
Simon Kuran
<p>The website I'm working on has different sections and each section different types of entries. I would like the types of entries to be shown in the URL. I have followed <a href="http://buildwithcraft.com/help/entry-type-urls" rel="noreferrer">this tutorial to do so</a>. </p>

<p>In a site example.com where we have:</p>

<ul>
<li>A Section called: My Section</li>
<li>With Entry Types: Example Entry Type, Another Entry type.</li>
</ul>

<p>Utilizing the model from the tutorial, we could structure the URL for <em>My Section</em> as follows:</p>

<p>/my-section/{type}/{slug}</p>

<p>Which would give us URLs like these:</p>

<ul>
<li>example.com/my-section/<strong>exampleEntryType</strong>/new-entry-1</li>
<li>example.com/my-section/<strong>exampleEntryType</strong>/new-entry-2</li>
<li>example.com/my-section/<strong>anotherEntryType</strong>/new-entry-3</li>
<li>example.com/my-section/<strong>anotherEntryType</strong>/new-entry-4</li>
</ul>

<p>Notice that the <strong>entry types</strong> are the only part of the URL camelCased. This is  because Entry Types can only be configured to have a Name, and a Handle; and handles can NOT have dashes. This interferes with keeping URLs consistent as the rest of the site uses dashes instead of spaces</p>

<p>The problem I am trying to solve is: how do we get the Entry Types to stay consistent with the rest of the site?</p>

<p>Does anyone have any suggestion on how to deal with this? Is this a problem that should be addressed in Craft? Should I be taking another approach for this?</p>

<p>I had considered using categories but the way the system is setup, entry types seem more appropriate. </p>

<entry-type><url>
Entry Types Custom Slug
# Entry Types Custom Slug

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

The website I'm working on has different sections and each section different types of entries. I would like the types of entries to be shown in the URL. I have followed [this tutorial to do so](http://buildwithcraft.com/help/entry-type-urls).

In a site example.com where we have:

* A Section called: My Section
* With Entry Types: Example Entry Type, Another Entry type.

Utilizing the model from the tutorial, we could structure the URL for *My Section* as follows:

/my-section/{type}/{slug}

Which would give us URLs like these:

* example.com/my-section/**exampleEntryType**/new-entry-1
* example.com/my-section/**exampleEntryType**/new-entry-2
* example.com/my-section/**anotherEntryType**/new-entry-3
* example.com/my-section/**anotherEntryType**/new-entry-4

Notice that the **entry types** are the only part of the URL camelCased. This is because Entry Types can only be configured to have a Name, and a Handle; and handles can NOT have dashes. This interferes with keeping URLs consistent as the rest of the site uses dashes instead of spaces

The problem I am trying to solve is: how do we get the Entry Types to stay consistent with the rest of the site?

Does anyone have any suggestion on how to deal with this? Is this a problem that should be addressed in Craft? Should I be taking another approach for this?

I had considered using categories but the way the system is setup, entry types seem more appropriate.

**Tags:** entry-type, url

---

## 3 answers

### Answer by username_4 on 2014-07-06. Score: 10 | Accepted answer

You could just set your "Entry URL Format" to:
my-section/{type.name}/{slug}

Your entry type names couldn't be as clean when composing entries in the CP as you'd need to set them to something like "example-entry-type", but it would work.

Now for the really clean way:
Install the Low Regex for Craft plugin.
Set "Entry URL Format" to:
my-section/{type.handle|regex('/(^|[a-z])([A-Z])/e', 'strtolower(strlen("\\1") ? "\\1-\\2" : "\\2")',(type.handle))}/{slug}

This will convert the entry type handle from camelCase to all lowercase with dashes as word delimiters. Set the entry type handles to be like "exampleEntryType" and they will become "example-entry-type" when in a slug.

> **Comments:**
> **username_0**: Ahhh, I overlooked the usefulness of that plugin. I think I will go for that. It's a shame there's no native way of doing it but for now this is just as good. Thanks a lot Simon!  
> **username_4**: No problem, glad it'll work for you!  
> **username_5**: I believe this is [native now](http://buildwithcraft.com/docs/templating/filters#replace). Something like this may for for you. `my-section/{ type.handle|replace('/(^|[a-z])([A-Z])/', '\\1-\\2')|lower }/{slug}`.  

---

### Answer by username_1 on 2016-08-24. Score: 3

You can use twig filters in url structures as mentioned by RhealPoirier in a comment above, no need for a plugin:
my-section/{type.handle|replace('/(^|[a-z])([A-Z])/', '\\1-\\2')|lower}/{slug}

or
my-section/{type.name|kebab}/{slug}


---

### Answer by username_2 on 2014-07-06. Score: 3

You can change the slug for the entry type to be whatever you want it to be. The one generated by Craft with the -'s is a default, not a requirement. Also there is a config setting, [slugWordSeparator](http://buildwithcraft.com/docs/config-settings#slugWordSeparator) to control the default word separator.

> **Comments:**
> **username_0**: From what I'm seeing now, entry types (not each entry, but the group of entry types) only have a 'name' and a 'handle'. This can be seen in the following screenshot.  https://www.dropbox.com/s/yirnzrc7dn7jfqn/Screenshot%202014-07-06%2012.42.26.png  
> **username_3**: entry type's don't have slugs and the handle cannot have dashes, although the name can.  

---

