diff --git a/layouts/partials/minimal-footer.html b/layouts/partials/minimal-footer.html
index bc895045..60ba32dc 100644
--- a/layouts/partials/minimal-footer.html
+++ b/layouts/partials/minimal-footer.html
@@ -70,15 +70,23 @@
{{ with .Params.categories }}
{{ if eq (len $.Site.Taxonomies.categories) 2 }}
- {{- $categoryNow := (delimit . " ") -}}
- {{- with $.Site.GetPage (printf `/categories/%s` $categoryNow) -}}
-
{{ $categoryNow | lower }}
+ {{- range . -}}
+ {{- $categoryNow := (. | urlize) -}}
+ {{- $.Scratch.Set "categoryNow" $categoryNow -}}
+ {{- end -}}
+ {{- $categoryNow := $.Scratch.Get "categoryNow" -}}
+ {{- $url := urls.Parse $categoryNow -}}
+ {{- $path := $url.Path -}}
+ {{- with $.Site.GetPage (printf `/categories/%s` $path) -}}
+
{{ .Slug | default .LinkTitle | default $path | lower | anchorize }}
{{- end -}}
{{- printf `%s` " | " | safeHTML -}}
{{- range $category, $pages := $.Site.Taxonomies.categories -}}
+ {{- $category := urls.Parse ($category | urlize) -}}
{{- if ne (string $category) (string $categoryNow) -}}
- {{- with $.Site.GetPage (printf `/categories/%s` $category) -}}
-
{{ $category | lower }}
+ {{- $path := $category.Path -}}
+ {{- with $.Site.GetPage (printf `/categories/%s` $path) -}}
+
{{ .Slug | default .LinkTitle | default $path | lower | anchorize }}
{{- end -}}
{{- end -}}
{{- end -}}
@@ -91,8 +99,10 @@
{{- $.Scratch.Set "delimiter" "" -}}
{{- end -}}
{{- $delimiter := ($.Scratch.Get "delimiter") -}}
- {{- with $.Site.GetPage (printf `/categories/%s` .) -}}
- {{- printf `
%s%s` .RelPermalink (.LinkTitle | default $category) $delimiter | safeHTML -}}
+ {{- $url := urls.Parse ($category | urlize) -}}
+ {{- $path := $url.Path -}}
+ {{- with $.Site.GetPage (printf `/categories/%s` $path) -}}
+ {{- printf `
%s%s` .RelPermalink (.Slug | default .LinkTitle | default $category | lower | anchorize) $delimiter | safeHTML -}}
{{- end -}}
{{- end -}}
{{ end }}
diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html
index 83bf92ac..a4cf5260 100644
--- a/layouts/partials/post-meta.html
+++ b/layouts/partials/post-meta.html
@@ -56,13 +56,15 @@
{{- $icon -}}
{{- range $index, $category := . -}}
+ {{- $url := urls.Parse ($category | urlize) -}}
+ {{- $path := $url.Path -}}
{{- if lt $index $length -}}
{{- $.Scratch.Set "delimiter" ($.Site.Params.categoryDelimiter | default "/") -}}
{{- else -}}
{{- $.Scratch.Set "delimiter" "" -}}
{{- end -}}
{{- $delimiter := ($.Scratch.Get "delimiter") -}}
- {{- with $.Site.GetPage (printf `/categories/%s` .) -}}
+ {{- with $.Site.GetPage (printf `/categories/%s` $path) -}}
{{- printf `%s%s` .RelPermalink (.LinkTitle | default $category) $delimiter | safeHTML -}}
{{- end -}}
{{- end -}}
diff --git a/layouts/partials/tree/categories.html b/layouts/partials/tree/categories.html
index 22b926bf..f10a4c45 100644
--- a/layouts/partials/tree/categories.html
+++ b/layouts/partials/tree/categories.html
@@ -8,7 +8,16 @@ {{ .Title | default (.Type | title) }}
{{ .Scratch.Delete "categories" }}
{{ range $.Site.RegularPages }}
{{ with .Param "categories" }}
- {{ $category := (printf `/%s` (replace (delimit . " ") " " "/")) }}
+ {{ $.Scratch.Delete "category" }}
+ {{ $length := sub (len .) 1 }}
+ {{ range $index, $category := . }}
+ {{ $category := (printf `/%s` ($category | urlize)) }}
+ {{ $.Scratch.Add "category" $category }}
+ {{ if lt $index $length }}
+ {{ $.Scratch.Add "categories" (slice ($.Scratch.Get "category")) }}
+ {{ end }}
+ {{ end }}
+ {{ $category := $.Scratch.Get "category" }}
{{ $.Scratch.Add "categories" (slice $category) }}
{{ end }}
{{ end }}
@@ -18,9 +27,11 @@ {{ .Title | default (.Type | title) }}
{{ $depth := (len $categoryTerms) }}
{{ $padding := (mul $depth 2) }}
{{ $lastTerm := (delimit (last 1 $categoryTerms) " ") }}
- {{ with $.Site.GetPage (printf `/categories/%s` $lastTerm) }}
+ {{ $url := urls.Parse $lastTerm }}
+ {{ $path := $url.Path }}
+ {{ with $.Site.GetPage (printf `/categories/%s` $path) }}
- {{ .LinkTitle | default .Data.Term | default $lastTerm }}
+ {{ .LinkTitle | default .Data.Term | default $path }}
{{ if $.Site.Params.displayPostsCount }}
{{ printf "(%d)" (len .Data.category) }}
{{ end }}
@@ -31,7 +42,12 @@
{{ .Title | default (.Type | title) }}
{{ range $.Site.RegularPages }}
{{ $page := . }}
{{ with .Param "categories" }}
- {{ $category := (printf `/%s` (replace (delimit . " ") " " "/")) }}
+ {{ $.Scratch.Delete "category" }}
+ {{ range . }}
+ {{ $category := (printf `/%s` (. | urlize)) }}
+ {{ $.Scratch.Add "category" $category }}
+ {{ end }}
+ {{ $category := $.Scratch.Get "category" }}
{{ if eq $context $category }}
{{ $page.LinkTitle }}