From 09892946542971c2d26185fc25907568ea0e2a7b Mon Sep 17 00:00:00 2001
From: Alexander Bilz <mail@alexbilz.com>
Date: Sat, 20 Mar 2021 12:56:07 +0000
Subject: [PATCH] Allow . and # in Categories and Tags

---
 layouts/partials/taxonomy/tags.html       |   10 ++++++----
 layouts/index.html                        |    7 +------
 layouts/partials/taxonomy/categories.html |   10 ++++++----
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/layouts/index.html b/layouts/index.html
index 62f7e91..ecd78ae 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -37,12 +37,7 @@
                                              {{ else }} {{.Date.Format "Mon, Jan 2, 2006"}} 
                                              {{ end }}</span>
                         {{ with .Page.Params.Categories }}{{ partial "taxonomy/categories.html" . }}{{ end }}
-                        {{ with .Params.tags }}
-                            {{- range $index, $el := . -}}
-                                <a class="tag"
-                                   href="{{ ( printf "tags/%s/" ( . | urlize ) ) | relLangURL }}">{{ . }}</a>
-                            {{- end -}}
-                        {{ end }}
+                        {{ with .Page.Params.Tags }}{{ partial "taxonomy/tags.html" . }}{{ end }}
                     </div>
                 </div>
             </div>
diff --git a/layouts/partials/taxonomy/categories.html b/layouts/partials/taxonomy/categories.html
index fd4988d..1643f71 100644
--- a/layouts/partials/taxonomy/categories.html
+++ b/layouts/partials/taxonomy/categories.html
@@ -1,5 +1,7 @@
 <span class="separator">
-{{- range $index, $el := . -}}
-    <a class="category" href="{{ ( printf "categories/%s/" ( . | urlize ) ) | relLangURL }}">{{ . }}</a>
-{{- end -}}
-</span>
+    {{- range $index, $el := . -}}
+        {{- $category := replace . "#" "%23" -}}
+        {{- $category = replace $category "." "%2e" -}}
+        <a class="category" href="{{ ( printf "categories/%s/" ( $category | urlize ) ) | relLangURL }}">{{ . }}</a>
+    {{- end -}}
+</span>
\ No newline at end of file
diff --git a/layouts/partials/taxonomy/tags.html b/layouts/partials/taxonomy/tags.html
index 86c0673..231edb4 100644
--- a/layouts/partials/taxonomy/tags.html
+++ b/layouts/partials/taxonomy/tags.html
@@ -1,5 +1,7 @@
 <span class="separator">
-{{- range $index, $el := . -}}
-    <a class="tag" href="{{ ( printf "tags/%s/" ( . | urlize ) ) | relLangURL }}">{{ . }}</a>
-{{- end -}}
-</span>
+    {{- range $index, $el := . -}}
+    {{- $tag := replace . "#" "%23" -}}
+    {{- $tag = replace $tag "." "%2e" -}}
+    <a class="tag" href="{{ ( printf "tags/%s/" ( $tag | urlize ) ) | relLangURL }}">{{- . -}}</a>
+    {{- end -}}
+</span>
\ No newline at end of file

--
Gitblit v1.10.0