hugo: Taxonomies names does not match urlized
The documentation here says: https://gohugo.io/content-management/taxonomies/#preserve-taxonomy-values
“Therefore, if you want to have a taxonomy term with special characters such as Gérard Depardieu instead of Gerard Depardieu, set the value for preserveTaxonomyNames to true in your site config.”
“Note that if you use preserveTaxonomyNames and intend to manually construct URLs to the archive pages, you will need to pass the taxonomy values through the urlize template function.”
However, in v0.54.0 this is not the behaviour I am seeing. preserveTaxonomyNames is false, but names are not normalized.
I have defined a taxonomy called “author” which has peoples names in it.
However, when I do:
{{ with $.Site.GetPage (printf "/author/%s" ( $author | urlize )) }}
<a href="{{ .RelPermalink }}">{{ $author }}</a>
{{ end }}
It doesn’t get the page for authors with accents in their names
{{ "Olivier Cochard-Labbé" | urlize }} = olivier-cochard-labb%C3%A9
but the taxonomy is: olivier-cochard-labbé
How do I encode the url the same way that the taxonomy is encoded, or get the taxonomy to be urlize’d?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 16
Commits related to this issue
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 See #1064 See #1143 — committed to HugoBlox/hugo-blox-builder by gcushen 5 years ago
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 — committed to HugoBlox/theme-academic-cv by gcushen 5 years ago
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 See #1064 See #1143 — committed to rhewett/hugo-academic by gcushen 5 years ago
- fix: workaround Hugo GetPage/urlize bug with non-ASCII usernames Attempt to use anchorize rather than urlize for fetching user profiles for users with non-ASCII usernames. Apparently `anchorize` does... — committed to HugoBlox/hugo-blox-builder by gcushen 5 years ago
- fix: workaround Hugo GetPage/urlize bug with non-ASCII usernames Attempt to use anchorize rather than urlize for fetching user profiles for users with non-ASCII usernames. Apparently `anchorize` does... — committed to SJamieson/hugo-academic by gcushen 5 years ago
- fix: revert "fix: workaround Hugo GetPage/urlize bug with non-ASCII usernames" This reverts commit 03af4df1 Ensure `removePathAccents = true` in `config.toml` to workaround the Hugo bug: https://git... — committed to HugoBlox/hugo-blox-builder by gcushen 4 years ago
- fix: revert "fix: workaround Hugo GetPage/urlize bug with non-ASCII usernames" This commit completes 94e6169320faff9cdc3035fdf5951be8be8e6f1d in reverting commit 03af4df Ensure `removePathAccents = ... — committed to HugoBlox/hugo-blox-builder by gcushen 4 years ago
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 — committed to retrofocus/myblog by foobar 5 years ago
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 — committed to retrofocus/myblog by retrofocus 5 years ago
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 — committed to retrofocus/myblog by retrofocus 5 years ago
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 — committed to hikaruhorie/website by gcushen 5 years ago
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 — committed to abienstock/academic-kickstart by gcushen 5 years ago
- fix: workaround Hugo GetPage/urlize bug with non-ASCII usernames Attempt to use anchorize rather than urlize for fetching user profiles for users with non-ASCII usernames. Apparently `anchorize` does... — committed to YoungWilliamZ/hugo-academic by gcushen 5 years ago
- fix: revert "fix: workaround Hugo GetPage/urlize bug with non-ASCII usernames" This reverts commit 03af4df1 Ensure `removePathAccents = true` in `config.toml` to workaround the Hugo bug: https://git... — committed to YoungWilliamZ/hugo-academic by gcushen 4 years ago
- fix: revert "fix: workaround Hugo GetPage/urlize bug with non-ASCII usernames" This commit completes 94e6169320faff9cdc3035fdf5951be8be8e6f1d in reverting commit 03af4df Ensure `removePathAccents = ... — committed to YoungWilliamZ/hugo-academic by gcushen 4 years ago
- Fix handling of names or keywords with special characters Hugo sadly does not provide a robust way of retrieving the page belonging to a term key in case of special characters. As a workaround we us... — committed to munin-monitoring/munin-plugin-gallery by sumpfralle 4 years ago
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 — committed to appnavi/AppNaviBlog by Juris710 5 years ago
- fix: workaround Hugo bug with non-ASCII characters See https://github.com/gohugoio/hugo/issues/5687 See #1064 See #1143 — committed to zxforchid/zxforchid.github.io by gcushen 5 years ago
- fix: workaround Hugo GetPage/urlize bug with non-ASCII usernames Attempt to use anchorize rather than urlize for fetching user profiles for users with non-ASCII usernames. Apparently `anchorize` does... — committed to zxforchid/zxforchid.github.io by gcushen 5 years ago
- fix: revert "fix: workaround Hugo GetPage/urlize bug with non-ASCII usernames" This reverts commit 03af4df1 Ensure `removePathAccents = true` in `config.toml` to workaround the Hugo bug: https://git... — committed to zxforchid/zxforchid.github.io by gcushen 4 years ago
I’ve got it working by fixing theme templates by changing from this
to this
Anchorize function doesn’t do urlencoding.
I’ve the same problem, I think hugo should have a function to calculate a key from a name (a term name here) like toKey, toIndex, keyize or indexize with the same logic it’s internal do to calculate the index/key
anchorize, and urlize are not for this purpose and user use them because such a function do not exists