# Remove competely accents from URL

**URL:** https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416
**Category:** support
**Created:** [November 3, 2021, 1:13am UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416 "2021-11-03T01:13:56Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Bui\_Nguy\_n\_Hoang\_Th](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bui_nguy_n_hoang_th/32/14972_2.png) [@Bui\_Nguy\_n\_Hoang\_Th](https://discourse.gohugo.io/u/Bui_Nguy_n_Hoang_Th)
#### Post date: [November 3, 2021, 1:13am UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/1 "2021-11-03T01:13:56Z")

</div>

Hello guys. I has been struggling with this problem all morning. The problem is. , in Vietnamese, we have also accent for **d** is “ **đ** ”. I’m trying to make my category taxonomy completely slug and without accents

Example : I have an tag call “ **Đông** ”. Url expected is “/the/dong”. But some how, when i add tag to my posts. It show **/the/đong** in url.

`removePathAccents = true` is not solve the problem. It only remove other accent, but with “ **đ** ” is not. So how can i fix this?

It similiar with this bug report

> <https://github.com/gohugoio/hugo/issues/4832>
>
> I use removePathAccents = true in config.toml file for remove accented in URL, b…ut seem it work not stable with some characters.
> 
> !\[untitled\](https://user-images.githubusercontent.com/28822504/41163976-3fcd3b8a-6b64-11e8-96a9-5aec55a0c442.png)
> 
> My permalinks config:
> \`\`\`
> \[permalinks\]
> article = "/:year/:month/:title/"
> \`\`\`

---

<div class="post-metadata">

### Author: ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)
#### Post date: [November 3, 2021, 5:20am UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/2 "2021-11-03T05:20:12Z")

</div>

You can’t trust Hugo and its upstream dependencies with these things. It’s probably better to set these parts of the URL by yourself. There are frontmatter options available for that:

> **[Content Organization](https://gohugo.io/content-management/organization#paths-explained)**
>
> Hugo assumes that the same structure that works to organize your source content is used to organize the rendered site.

Either do it in each post with `url` or use the `slug` frontmatter for the folder (if the special character is in the foldername).

---

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [November 3, 2021, 7:29am UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/3 "2021-11-03T07:29:02Z")

</div>

> **What is a character?**
> 
> …characters can span multiple runes. For example, an&nbsp;`e`&nbsp;and&nbsp;`◌́`&nbsp;(acute `\u0301`) can combine to form `é`&nbsp;(`e\u0301` in NFD). Together these two runes are one character.
> 
> See [https://go.dev/blog/normalization#what-is-a-character-h2](https://go.dev/blog/normalization#what-is-a-character-h2)

The `◌́`&nbsp;(acute `\u0301`) rune is a member of the [Nonspacing Mark](https://www.compart.com/en/unicode/category/Mn) (Mn) unicode category.

Hugo’s `removePathAccents` setting removes all runes in the Mn category. For example, `José` becomes `Jose`.

The [character `đ`](https://www.compart.com/en/unicode/U+0111) is _not_ a combination of the letter `d` with a non-spacing mark. It is a lower case letter, and will not be affected by the `removePathAccents` settings.

The same is true with characters such as `ł`, `ƚ`, `ŧ`, and `ħ`. They may _look_ like a combination of a letter and non-spacing mark, but they are not.

If we wanted to do something like this:

```plaintext
đéłƚŧħß --> dellthss

```

We would need to incorporate something like [iconv](https://linux.die.net/man/1/iconv).

```bash
iconv -c -f utf8 -t ascii//TRANSLIT <<< "đéłƚŧħß"

```

---

<div class="post-metadata">

### Author: ![Bui\_Nguy\_n\_Hoang\_Th](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bui_nguy_n_hoang_th/32/14972_2.png) [@Bui\_Nguy\_n\_Hoang\_Th](https://discourse.gohugo.io/u/Bui_Nguy_n_Hoang_Th)
#### Post date: [November 3, 2021, 8:57am UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/4 "2021-11-03T08:57:50Z")

</div>

Yes i tried to change url/slug in tag  
Example with tag “Đông”, i change in content/tags/đong/\_index.md

```auto
title: "Đông"
slug: "/the/dong"

```

In my post example.md, I’m using front-matter:

```auto
title: "Hello world"
the : 
     - Đông

```

But when i check it again. in **mywebsite/the/dong** , it give me empty list, not show my “Hello world” post.  
What wrong with me

---

<div class="post-metadata">

### Author: ![Bui\_Nguy\_n\_Hoang\_Th](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bui_nguy_n_hoang_th/32/14972_2.png) [@Bui\_Nguy\_n\_Hoang\_Th](https://discourse.gohugo.io/u/Bui_Nguy_n_Hoang_Th)
#### Post date: [November 3, 2021, 9:04am UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/5 "2021-11-03T09:04:38Z")

</div>

Interesting idea. But how can i use it in Hugo ?

---

<div class="post-metadata">

### Author: ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)
#### Post date: [November 3, 2021, 12:35pm UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/6 "2021-11-03T12:35:03Z")

</div>

You should use `url` instead of `slug` if you use the full path from your website root for the value. in `slug` it should only be `dong` without the folder it’s in.

---

<div class="post-metadata">

### Author: ![Bui\_Nguy\_n\_Hoang\_Th](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bui_nguy_n_hoang_th/32/14972_2.png) [@Bui\_Nguy\_n\_Hoang\_Th](https://discourse.gohugo.io/u/Bui_Nguy_n_Hoang_Th)
#### Post date: [November 3, 2021, 1:10pm UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/7 "2021-11-03T13:10:32Z")

</div>

Okay thanks for your help . It working. Now one small slight problem is. The taxonomy of Hugo is generated a link whenever i input a tag into front matter . But with accent like i said above.  
So can i use `replace` in url?. Tried below method but it still not working  
Like this:

```auto
<div class="tag-container">
    {{ range .Params.tag }}
// replace everytag tag start with "đ" word with "d"
    {{$tag := replace . "đ" "d"}}
    <a href="/tag/{{$tag |urlize }}" class="tag-item--article">#{{.}}</a>
    {{end}}
 
</div>

```

---

<div class="post-metadata">

### Author: ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)
#### Post date: [November 3, 2021, 1:26pm UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/8 "2021-11-03T13:26:56Z")

</div>

You can add content files with frontmatter for all your tags (or just some), see " Add custom metadata to a Taxonomy or Term":

> **[Taxonomies](https://gohugo.io/content-management/taxonomies/)**
>
> Hugo includes support for user-defined taxonomies.

---

<div class="post-metadata">

### Author: ![Bui\_Nguy\_n\_Hoang\_Th](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bui_nguy_n_hoang_th/32/14972_2.png) [@Bui\_Nguy\_n\_Hoang\_Th](https://discourse.gohugo.io/u/Bui_Nguy_n_Hoang_Th)
#### Post date: [November 3, 2021, 1:46pm UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/9 "2021-11-03T13:46:20Z")

</div>

You might miss here.  
If you look above, i’m trying replace any tag start have an name start with “ **đ** ”. Then replace to **“d”** only.  
The metadata part is done. Just added it. Now i’m doing the **replace** part

---

<div class="post-metadata">

### Author: ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)
#### Post date: [November 3, 2021, 2:07pm UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/10 "2021-11-03T14:07:47Z")

</div>

Pretty sure I don’t but we have some language issues here 😉

Let’s assume this is lowercase “dong”:

```auto
Đông

```

You create a file `content/tags/dong/_index.md` with the following content:

```auto
---
title: Đông
slug: dong
---

```

Then you refer to the tag in your contents frontmatter with:

```auto
tags: ["dong", "other", "tags"]

```

and it will display `Đông` and link to `dong`

---

<div class="post-metadata">

### Author: ![Bui\_Nguy\_n\_Hoang\_Th](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bui_nguy_n_hoang_th/32/14972_2.png) [@Bui\_Nguy\_n\_Hoang\_Th](https://discourse.gohugo.io/u/Bui_Nguy_n_Hoang_Th)
#### Post date: [November 3, 2021, 2:19pm UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/11 "2021-11-03T14:19:32Z")

</div>

Thanks you so much. Finally figure how to make it work xD

---

<div class="post-metadata">

### Author: ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)
#### Post date: [November 5, 2021, 2:19pm UTC](https://discourse.gohugo.io/t/remove-competely-accents-from-url/35416/12 "2021-11-05T14:19:50Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
