# How to customize post permalinks?

**URL:** <https://discourse.gohugo.io/t/how-to-customize-post-permalinks/4898>\
**Category:** support\
**Created:** [December 23, 2016, 6:34pm UTC](https://discourse.gohugo.io/t/how-to-customize-post-permalinks/4898 "2016-12-23T18:34:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreyg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/andreyg/32/2384_2.png) [@andreyg](https://discourse.gohugo.io/u/andreyg)\
**Post date:** [December 23, 2016, 6:34pm UTC](https://discourse.gohugo.io/t/how-to-customize-post-permalinks/4898/1 "2016-12-23T18:34:07Z")

</div>

Hey guys,

I continue to migrate my website to Hugo. Today I’m struggling with permalinks and need your help. Here is the URL structure that is currently used on my existing website:

```auto
(1) http://www.domain.com/categories/
(2) http://www.domain.com/category/golang/
(3) http://www.domain.com/category/golang/introduction-to-golang

```

(1) is a no-brainer and easy to set up with Hugo.  
As for (2) and (3) – they are weird, since taxonomy name is singular (_category_ instead of _categories_).  
In my case, number (2) is easy to solve by creating **aliases** inside the front-matter (\_index.md) for each taxonomy term.

The real problem is (3). On my existing website, there are facebook/twitter/G+ social buttons with _ **hundreds** _ of likes. Unfortunately, those social platforms do not respect 301 redirect, so if I change the structure of post urls, I’ll loose all the social counts.

In a perfect world I would like to keep old urls as they are and let Hugo build its own url structure for new posts.

Any ideas here? I also consider Nginx-based solutions.

---

<div class="post-metadata">

**Author:** ![digitalcraftsman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/digitalcraftsman/32/4142_2.png) [@digitalcraftsman](https://discourse.gohugo.io/u/digitalcraftsman)\
**Post date:** [December 23, 2016, 6:58pm UTC](https://discourse.gohugo.io/t/how-to-customize-post-permalinks/4898/2 "2016-12-23T18:58:05Z")

</div>

For (2) you don’t need to create aliases. Hugo allows you to change the default permalinks in the config file\_

```auto
[taxonomies]
category = "categories"

```

To my knowledge, (3) can’t be used to define a permalink à la `www.domain.com/category/[category-name]/[slug]` with the available options.

Aliases are hard to maintain. Once you change the structure of a permalink you have to update the aliases as well.

---

<div class="post-metadata">

**Author:** ![andreyg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/andreyg/32/2384_2.png) [@andreyg](https://discourse.gohugo.io/u/andreyg)\
**Post date:** [December 23, 2016, 7:12pm UTC](https://discourse.gohugo.io/t/how-to-customize-post-permalinks/4898/3 "2016-12-23T19:12:50Z")

</div>

> [@digitalcraftsman](#):
>
> For (2) you don’t need to create aliases. Hugo allows you to change the default permalinks in the config file

I see a blank page (200 OK) by going to `/category/golang/`. What template is responsible for rendering this url?  
`/categories/golang/` works fine though.

---

<div class="post-metadata">

**Author:** ![digitalcraftsman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/digitalcraftsman/32/4142_2.png) [@digitalcraftsman](https://discourse.gohugo.io/u/digitalcraftsman)\
**Post date:** [December 23, 2016, 7:17pm UTC](https://discourse.gohugo.io/t/how-to-customize-post-permalinks/4898/4 "2016-12-23T19:17:25Z")

</div>

> [@andreyg](#):
>
> I see a blank page (200 OK) by going to /category/golang/. What template is responsible for rendering this url?

By default it’s `layouts/_default/list.html`.

> [@andreyg](#):
>
> /categories/golang/ works fine though.

Isn’t this what tried to change with aliases?

> [@andreyg](#):
>
> As for (2) and (3) – they are weird, since taxonomy name is singular (category instead of categories). In my case, number (2) is easy to solve by creating aliases inside the front-matter (\_index.md) for each taxonomy term.

---

<div class="post-metadata">

**Author:** ![andreyg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/andreyg/32/2384_2.png) [@andreyg](https://discourse.gohugo.io/u/andreyg)\
**Post date:** [December 23, 2016, 7:38pm UTC](https://discourse.gohugo.io/t/how-to-customize-post-permalinks/4898/5 "2016-12-23T19:38:06Z")

</div>

@digitalcraftsman sorry, nvm. You are hundred percent right. Please, ignore my last comment.  
_I saw blank page because I had `/content/category/` folder that shouldn’t exist._

Without aliases, going to `/category/golang/` results to a 404. My config.yaml does have taxonomies set up.

Anyhow, this ^ is not a problem, since I can really solve it with aliases. Thanks, though.
