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?
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:
Either do it in each post with url or use the slug frontmatter for the folder (if the special character is in the foldername).
…characters can span multiple runes. For example, an e and ◌́ (acute \u0301) can combine to form é (e\u0301 in NFD). Together these two runes are one character.
The ◌́ (acute \u0301) rune is a member of the Nonspacing Mark (Mn) unicode category.
Hugo’s removePathAccents setting removes all runes in the Mn category. For example, José becomes Jose.
The character đ 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:
đéłƚŧħß --> dellthss
We would need to incorporate something like iconv.
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.
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:
<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>
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