<p>In the CP, in the settings window for 'categories' you can set whether 'Categories in this group have their own URLs', and define the 'Category URL Formats' for categories and subcategories, and choose a category template. You could use <code>{slug}</code> for example, to route to the index page of the category (or whatever you want to use it for). Of course, you may not need this at all if you don't plan on having a landing or index page for the category.</p>

<p>For getting to an actual entry you would need to set a custom route in the CP using tokens. You could create <code>category/slug</code> for example (where 'category' is your category name, and 'slug' is a token) which would point to your <code>_categoryentry.html</code> template. Any tokens you define will be variables available in your template that you can use to retrieve the appropriate entry.</p>

<p>If your entries will always only belong to one and only one category, then you may consider using the structure itself (i.e. inserting the categories into the structure itself as another level), which will provide the uri you are looking for automatically.</p>

<p>For more information, see the documentation on <a href="http://buildwithcraft.com/docs/routing" rel="nofollow">routing</a>, and <a href="http://buildwithcraft.com/docs/categories" rel="nofollow">categories</a>.</p>

CC BY-SA 3.0
2014-10-29T03:08:09.433Z
I think in my case then, maybe I am looking to use categories in the wrong manner. My entries will belong to one category so using the structure makes sense. But I am still confused as to when to use categories versus a structure.
user3818623
CC BY-SA 3.0
2014-10-29T07:23:02.583Z
You might choose to use a category when you want an item (like an article, project, or product) to show up in more than one section. You can then simply assign the relevant categories to the items, and have them show up where you want them. The downside is that when you go to the item, the uri will not include the category by default without some extra configuration. But the uri `/projects/project-name` is fine for most cases, and there are workarounds to get '/category/project-name'.
Douglas McDonald
CC BY-SA 3.0
2014-10-27T22:06:51.863Z
2014-10-28T00:27:49.327Z
2014-10-28T00:27:49.327Z
Douglas McDonald
<p>I have a structure section. For that section, I have some categories. Each entry has a field where I can select the category that entry belongs to. </p>

<p>How do I include the category uri? For example, "section/category/entry". </p>

<category>
Add category to uri
# Add category to uri

(Asked by: username_0 on 2014-10-27)

I have a structure section. For that section, I have some categories. Each entry has a field where I can select the category that entry belongs to.

How do I include the category uri? For example, "section/category/entry".

**Tags:** category

---

## 1 answers

### Answer by username_1 on 2014-10-27. Score: 4 | Accepted answer

In the CP, in the settings window for 'categories' you can set whether 'Categories in this group have their own URLs', and define the 'Category URL Formats' for categories and subcategories, and choose a category template. You could use `{slug}` for example, to route to the index page of the category (or whatever you want to use it for). Of course, you may not need this at all if you don't plan on having a landing or index page for the category.

For getting to an actual entry you would need to set a custom route in the CP using tokens. You could create `category/slug` for example (where 'category' is your category name, and 'slug' is a token) which would point to your `_categoryentry.html` template. Any tokens you define will be variables available in your template that you can use to retrieve the appropriate entry.

If your entries will always only belong to one and only one category, then you may consider using the structure itself (i.e. inserting the categories into the structure itself as another level), which will provide the uri you are looking for automatically.

For more information, see the documentation on [routing](http://buildwithcraft.com/docs/routing), and [categories](http://buildwithcraft.com/docs/categories).

> **Comments:**
> **username_0**: I think in my case then, maybe I am looking to use categories in the wrong manner. My entries will belong to one category so using the structure makes sense. But I am still confused as to when to use categories versus a structure.  
> **username_1**: You might choose to use a category when you want an item (like an article, project, or product) to show up in more than one section. You can then simply assign the relevant categories to the items, and have them show up where you want them. The downside is that when you go to the item, the uri will not include the category by default without some extra configuration. But the uri `/projects/project-name` is fine for most cases, and there are workarounds to get '/category/project-name'.  

---

