<p>When you save an entry/category that is supposed to have its own URL, Craft will assign it a unique URI, based on the section/category group’s URL Format setting.</p>

<p>For example, let’s say you have a section called News, and its “Entries in this section have their own URLs” checkbox is checked, and it has this URL Format:</p>

<pre><code>news/{slug}
</code></pre>

<p>When you save a News entry, Craft will assign it a unique URI based on that URL Format. If the entry’s slug is “foo”, then the first URI Craft will try to assign it will be “news/foo”.</p>

<p>However, if that URI is already taken by another entry/category (or some third party element type), Craft will increment the slug and try again:</p>

<ul>
<li>news/foo-1</li>
<li>news/foo-2</li>
<li>news/foo-3</li>
<li>etc.</li>
</ul>

<p>(If incrementing the slug has no effect on the URI – because the URL Format doesn’t actually contain a <code>{slug}</code> token – then Craft will simply give up and add a validation error to the element.)</p>

<p>Once it has found a URI that is actually unique, it will update the element’s Slug with the incremented version.</p>

<p>So in your case, when you save a category with the slug “australia” and it becomes “australia-6“, that means that you have 6 other elements that had been saved with the slug “australia” before it, with the same URL Format that your current category has, and so “australia-6” was just the first slug Craft could find that resulted in your category having a unique URI.</p>

<p>To find out which elements your category’s URI is conflicting with, you can go to Entries > All Entries, and search for <code>slug:australia</code>, and click through each of your category groups in the Categories tab, searching for <code>slug:australia</code> in each of them.</p>

CC BY-SA 3.0
2015-10-02T07:50:39.673Z
Thanks Brandon for the detailed explanation. I understand the auto-increment of slug URIs for uniqueness. This is for a category as opposed to an entry but I see categories have slug entries too. The thing is there are no other Australia entries anywhere in the admin interface - but there are entries in the craft_content table or Australia. So I was expecting 'australia-6' to be changeable.
joomkit
CC BY-SA 3.0
2015-10-02T14:06:06.947Z
Actually found the slugs in i18n table and removed them and element ids. This now allows me to recreate Australia slug as desired :)
joomkit
CC BY-SA 3.0
2015-10-01T22:06:10.550Z
2015-10-01T22:06:10.550Z
Brandon Kelly
<p>I have a category Australia and have been experimenting with boboldehampsink import plugin.</p>

<p>After deleting categories and starting over the category Australia now has a slug called 'australia-6'. I just want 'australia' but i cant get rid of the  hypen and 6.</p>

<p>I notice the content table has lots of entries for australia but no slugs so I'm wondering about the db schema for craftcms and how come i have got a stuck slug so quickly?</p>

<categories><slug>
Category slug is getting numbers appended to it
# Category slug is getting numbers appended to it

(Asked by: username_0 on 2015-10-01)

I have a category Australia and have been experimenting with boboldehampsink import plugin.

After deleting categories and starting over the category Australia now has a slug called 'australia-6'. I just want 'australia' but i cant get rid of the hypen and 6.

I notice the content table has lots of entries for australia but no slugs so I'm wondering about the db schema for craftcms and how come i have got a stuck slug so quickly?

**Tags:** categories, slug


---

## 1 answers

### Answer by username_1 on 2015-10-01. Score: 2

When you save an entry/category that is supposed to have its own URL, Craft will assign it a unique URI, based on the section/category group’s URL Format setting.
For example, let’s say you have a section called News, and its “Entries in this section have their own URLs” checkbox is checked, and it has this URL Format:
news/{slug}

When you save a News entry, Craft will assign it a unique URI based on that URL Format. If the entry’s slug is “foo”, then the first URI Craft will try to assign it will be “news/foo”.
However, if that URI is already taken by another entry/category (or some third party element type), Craft will increment the slug and try again:

news/foo-1
news/foo-2
news/foo-3
etc.

(If incrementing the slug has no effect on the URI – because the URL Format doesn’t actually contain a {slug} token – then Craft will simply give up and add a validation error to the element.)
Once it has found a URI that is actually unique, it will update the element’s Slug with the incremented version.
So in your case, when you save a category with the slug “australia” and it becomes “australia-6“, that means that you have 6 other elements that had been saved with the slug “australia” before it, with the same URL Format that your current category has, and so “australia-6” was just the first slug Craft could find that resulted in your category having a unique URI.
To find out which elements your category’s URI is conflicting with, you can go to Entries > All Entries, and search for slug:australia, and click through each of your category groups in the Categories tab, searching for slug:australia in each of them.

> **Comments:**
> **username_0**: Thanks Brandon for the detailed explanation. I understand the auto-increment of slug URIs for uniqueness. This is for a category as opposed to an entry but I see categories have slug entries too. The thing is there are no other Australia entries anywhere in the admin interface - but there are entries in the craft_content table or Australia. So I was expecting 'australia-6' to be changeable.  
> **username_0**: Actually found the slugs in i18n table and removed them and element ids. This now allows me to recreate Australia slug as desired :)  

---

