diff --git a/layouts/partials/function/path.html b/layouts/partials/function/path.html index 0a5efd19..4fade7db 100644 --- a/layouts/partials/function/path.html +++ b/layouts/partials/function/path.html @@ -1,4 +1,4 @@ {{- /* https://discourse.gohugo.io/t/how-decode-urls-in-hugo/7549/4 */ -}} -{{- /* https://github.com/hugo-fixit/FixIt/issues/245 */ -}} -{{- $URL := . | urlize | urlquery | urls.Parse -}} +{{- $URL := partial "function/urlquery.html" . -}} +{{- $URL = $URL | urlize | urls.Parse -}} {{- return $URL.Path -}} diff --git a/layouts/partials/function/urlquery.html b/layouts/partials/function/urlquery.html new file mode 100644 index 00000000..52ec2711 --- /dev/null +++ b/layouts/partials/function/urlquery.html @@ -0,0 +1,6 @@ +{{- /* Escape url special characters to query format, e.g: `#` -> `%23` */ -}} +{{- /* https://github.com/hugo-fixit/FixIt/issues/245 */ -}} + +{{- $content := . -}} +{{- $content = replace $content "#" "%23" -}} +{{- return $content -}}