From b540350d76c3710642d9349bac021e8345321a8f Mon Sep 17 00:00:00 2001
From: Jimmy Cai <jimmehcai@gmail.com>
Date: Fri, 18 Sep 2020 00:00:39 +0200
Subject: [PATCH 1/3] feat(article): add support for custom taxonomy link

---
 .../partials/article/components/details.html  | 25 +++++++++++--------
 .../partials/article/components/footer.html   |  8 +-----
 layouts/partials/article/components/tags.html | 10 ++++++++
 3 files changed, 25 insertions(+), 18 deletions(-)
 create mode 100644 layouts/partials/article/components/tags.html

diff --git a/layouts/partials/article/components/details.html b/layouts/partials/article/components/details.html
index 89d5554..1e7ea18 100644
--- a/layouts/partials/article/components/details.html
+++ b/layouts/partials/article/components/details.html
@@ -1,16 +1,19 @@
-{{ $image := partialCached "helper/image" (dict "Context" .) .RelPermalink }}
-{{ $context := . }}
+{{- $image := partialCached "helper/image" (dict "Context" .) .RelPermalink -}}
+{{- $context := . -}}
+{{- $categories := .Params.categories -}}
 <div class="article-details">
-    {{ with $categories := .Params.categories }}
+    {{ if $categories }}
     <header class="article-category">
-        {{ range $categories }}
-            {{ if and $image.exists $image.resource }}
-                {{- $imageRaw := $image.resource | resources.Fingerprint "md5"  -}}
-                {{- $20x := $imageRaw.Fill "20x20 smart"  -}}
-                <a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}" class="color-tag"
-                    data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ . | humanize }}</a>
-            {{ else }}
-                <a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}">{{ . | humanize }}</a>
+        {{ range $category := $categories }}
+            {{ with $.Site.GetPage (printf "/categories/%s" $category) }}
+                {{ if and $image.exists $image.resource }}
+                    {{- $imageRaw := $image.resource | resources.Fingerprint "md5"  -}}
+                    {{- $20x := $imageRaw.Fill "20x20 smart"  -}}
+                    <a href="{{ .Permalink }}" class="color-tag"
+                        data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ .Title | humanize }}</a>
+                {{ else }}
+                    <a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}">{{ .Title | humanize }}</a>
+                {{ end }}
             {{ end }}
         {{ end }}
     </header>
diff --git a/layouts/partials/article/components/footer.html b/layouts/partials/article/components/footer.html
index 102bc4a..3431c81 100644
--- a/layouts/partials/article/components/footer.html
+++ b/layouts/partials/article/components/footer.html
@@ -1,11 +1,5 @@
 <footer class="article-footer">
-    {{ with $tags := .Params.Tags }}
-    <section class="article-tags">
-        {{ range $tags }}
-        <a href="{{ printf `tags/%s` (. | urlize) | relLangURL }}">{{ . | humanize }}</a>
-        {{ end }}
-    </section>
-    {{ end }}
+    {{ partial "article/components/tags" . }}
 
     {{ if and (.Site.Params.article.license.enabled) (not (eq .Params.license false)) }}
     <section class="article-copyright">
diff --git a/layouts/partials/article/components/tags.html b/layouts/partials/article/components/tags.html
new file mode 100644
index 0000000..73446cd
--- /dev/null
+++ b/layouts/partials/article/components/tags.html
@@ -0,0 +1,10 @@
+{{- $tags := .Params.Tags -}}
+{{ if $tags }}
+    <section class="article-tags">
+        {{ range $tag := $tags }}
+            {{ with $.Site.GetPage (printf "/tags/%s" $tag) }}
+                <a href="{{ .Permalink }}">{{ .Title | humanize }}</a>
+            {{ end }}
+        {{ end }}
+    </section>
+{{ end }}
\ No newline at end of file

From b2a1afd744f84a459934043d80548dd1b0a34365 Mon Sep 17 00:00:00 2001
From: Jimmy Cai <jimmehcai@gmail.com>
Date: Fri, 18 Sep 2020 10:58:38 +0200
Subject: [PATCH 2/3] feat(tag cloud): add support for custom taxonomy link

---
 layouts/partials/widget/tag-cloud.html | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/layouts/partials/widget/tag-cloud.html b/layouts/partials/widget/tag-cloud.html
index 1fa8efe..a29b382 100644
--- a/layouts/partials/widget/tag-cloud.html
+++ b/layouts/partials/widget/tag-cloud.html
@@ -8,9 +8,10 @@
 
     <div class="tagCloud-tags">
         {{ range first .Site.Params.widgets.tagCloud.limit $tags }}
-        <a href="{{ printf `tags/%s` (.Term | urlize) | relLangURL }}" class="font_size_{{ .Count }}">
-            {{ .Term | humanize }}
-        </a>
+            {{ $term := $.Site.GetPage (printf "/tags/%s" .Term) }}
+            <a href="{{ $term.Permalink }}" class="font_size_{{ .Count }}">
+                {{ $term.Title | humanize }}
+            </a>
         {{ end }}
     </div>
 </section>
\ No newline at end of file

From 117dd4b81e8a0d6d0b95f7bcf1228fa74d793bb8 Mon Sep 17 00:00:00 2001
From: Jimmy Cai <jimmehcai@gmail.com>
Date: Fri, 18 Sep 2020 20:05:19 +0200
Subject: [PATCH 3/3] fix(article/details): fix custom taxonomy link

---
 .../partials/article/components/details.html    | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/layouts/partials/article/components/details.html b/layouts/partials/article/components/details.html
index 1a3faa9..016e9d6 100644
--- a/layouts/partials/article/components/details.html
+++ b/layouts/partials/article/components/details.html
@@ -5,15 +5,14 @@
     {{ if $categories }}
     <header class="article-category">
         {{ range $category := $categories }}
-            {{ with $.Site.GetPage (printf "/categories/%s" $category) }}
-                {{ if and $image.exists $image.resource }}
-                    {{- $imageRaw := $image.resource | resources.Fingerprint "md5"  -}}
-                    {{- $20x := $imageRaw.Fill "20x20 smart"  -}}
-                    <a href="{{ .Permalink }}" class="color-tag"
-                        data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ .Title | humanize }}</a>
-                {{ else }}
-                    <a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}">{{ .Title | humanize }}</a>
-                {{ end }}
+            {{ $term := $.Site.GetPage (printf "/categories/%s" $category) }}
+            {{ if and $image.exists $image.resource }}
+                {{- $imageRaw := $image.resource | resources.Fingerprint "md5"  -}}
+                {{- $20x := $imageRaw.Fill "20x20 smart"  -}}
+                <a href="{{ $term.Permalink }}" class="color-tag"
+                    data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ $term.Title | humanize }}</a>
+            {{ else }}
+                <a href="{{ $term.Permalink }}">{{ $term.Title | humanize }}</a>
             {{ end }}
         {{ end }}
     </header>