From 473ff712bdbecc0f9727ffe1bab49135191f19d1 Mon Sep 17 00:00:00 2001
From: Martin Hellspong <martin.hellspong@factor10.com>
Date: Thu, 05 Jan 2023 12:27:15 +0000
Subject: [PATCH] Add custom title / translation of categories (#755)

---
 layouts/posts/single.html                             |    2 +-
 exampleSite/content/posts/markdown-syntax.pt-br.md    |    4 ++--
 exampleSite/content/categories/syntax/_index.pt-br.md |    6 ++++++
 exampleSite/content/categories/themes/_index.pt-br.md |    6 ++++++
 layouts/partials/taxonomy/categories.html             |    2 +-
 5 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/exampleSite/content/categories/syntax/_index.pt-br.md b/exampleSite/content/categories/syntax/_index.pt-br.md
new file mode 100644
index 0000000..840c978
--- /dev/null
+++ b/exampleSite/content/categories/syntax/_index.pt-br.md
@@ -0,0 +1,6 @@
++++
+draft = false
+date = 2023-01-04T23:21:06+01:00
+title = "sintaxe"
+url = "categoria/sintaxe"
++++
diff --git a/exampleSite/content/categories/themes/_index.pt-br.md b/exampleSite/content/categories/themes/_index.pt-br.md
new file mode 100644
index 0000000..d2a277d
--- /dev/null
+++ b/exampleSite/content/categories/themes/_index.pt-br.md
@@ -0,0 +1,6 @@
++++
+draft = false
+date = 2023-01-04T23:21:18+01:00
+title = "temas"
+url = "categoria/temas"
++++
diff --git a/exampleSite/content/posts/markdown-syntax.pt-br.md b/exampleSite/content/posts/markdown-syntax.pt-br.md
index 90ed451..f95d626 100644
--- a/exampleSite/content/posts/markdown-syntax.pt-br.md
+++ b/exampleSite/content/posts/markdown-syntax.pt-br.md
@@ -9,8 +9,8 @@
     "html",
 ]
 categories = [
-    "temas",
-    "sintaxe",
+    "themes",
+    "syntax",
 ]
 series = ["Guia do Thema"]
 aliases = ["migrate-from-jekyl"]
diff --git a/layouts/partials/taxonomy/categories.html b/layouts/partials/taxonomy/categories.html
index b592f4e..aec7953 100644
--- a/layouts/partials/taxonomy/categories.html
+++ b/layouts/partials/taxonomy/categories.html
@@ -4,6 +4,6 @@
     {{- if gt $index 0 }}
       <span class="separator">•</span>
     {{- end }}
-    <a href="{{ ( printf "categories/%s/" ( . | urlize ) ) | relLangURL }}">{{ . }}</a>
+    <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
   {{- end -}}
 </div>
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index 655cf95..f89987c 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -26,7 +26,7 @@
             </span>
           </div>
           {{ with .GetTerms "authors" }}{{ partial "taxonomy/authors.html" . }}{{ end }}
-          {{ with .Page.Params.Categories }}{{ partial "taxonomy/categories.html" . }}{{ end }}
+          {{ with .GetTerms "categories" }}{{ partial "taxonomy/categories.html" . }}{{ end }}
           {{ with .GetTerms "tags" }}{{ partial "taxonomy/tags.html" . }}{{ end }}
         </div>
       </header>

--
Gitblit v1.10.0