mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-26 00:36:49 +01:00
fix(path): broken tag/category link when containing a dot (#368)
This commit is contained in:
parent
9c1244490f
commit
e5ae1d696b
4 changed files with 8 additions and 5 deletions
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
{{- $categories := slice -}}
|
{{- $categories := slice -}}
|
||||||
{{- range .Params.categories -}}
|
{{- range .Params.categories -}}
|
||||||
{{- $category := . | anchorize | printf "/categories/%v" | $.Site.GetPage -}}
|
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
||||||
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
|
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with delimit $categories " " -}}
|
{{- with delimit $categories " " -}}
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
<i class="fas fa-tags fa-fw"></i>
|
<i class="fas fa-tags fa-fw"></i>
|
||||||
{{- range $index, $value := . -}}
|
{{- range $index, $value := . -}}
|
||||||
{{- if gt $index 0 }}, {{ end -}}
|
{{- if gt $index 0 }}, {{ end -}}
|
||||||
{{- $tag := $value | anchorize | printf "/tags/%v" | $.Site.GetPage -}}
|
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
|
||||||
<a href="{{ $tag.RelPermalink }}">{{ $tag.Title }}</a>
|
<a href="{{ $tag.RelPermalink }}">{{ $tag.Title }}</a>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</div>
|
</div>
|
||||||
|
|
3
layouts/partials/function/path.html
Normal file
3
layouts/partials/function/path.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{{- /* https://discourse.gohugo.io/t/how-decode-urls-in-hugo/7549/4 */ -}}
|
||||||
|
{{- $URL := . | urlize | urls.Parse -}}
|
||||||
|
{{- return $URL.Path -}}
|
|
@ -51,7 +51,7 @@
|
||||||
<i class="fas fa-tags fa-fw"></i>
|
<i class="fas fa-tags fa-fw"></i>
|
||||||
{{- range $index, $value := . -}}
|
{{- range $index, $value := . -}}
|
||||||
{{- if gt $index 0 }}, {{ end -}}
|
{{- if gt $index 0 }}, {{ end -}}
|
||||||
{{- $tag := $value | anchorize | printf "/tags/%v" | $.Site.GetPage -}}
|
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
|
||||||
<a href="{{ $tag.RelPermalink }}">{{ $tag.Title }}</a>
|
<a href="{{ $tag.RelPermalink }}">{{ $tag.Title }}</a>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
{{- $categories := slice -}}
|
{{- $categories := slice -}}
|
||||||
{{- range .Params.categories -}}
|
{{- range .Params.categories -}}
|
||||||
{{- $category := . | anchorize | printf "/categories/%v" | $.Site.GetPage -}}
|
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
||||||
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
|
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with delimit $categories " " -}}
|
{{- with delimit $categories " " -}}
|
||||||
|
|
Loading…
Reference in a new issue