mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 23:38:56 +00:00
⚡ Perf: use .GetTerms optimization for getting terms on a page
This commit is contained in:
@@ -55,14 +55,12 @@
|
||||
{{- /* Footer */ -}}
|
||||
<div class="post-footer">
|
||||
<a href="{{ .RelPermalink }}">{{ T "single.readMore" }}</a>
|
||||
{{- with .Params.tags -}}
|
||||
{{- $tagTerms := .GetTerms "tags" -}}
|
||||
{{- if $tagTerms -}}
|
||||
<div class="post-tags">
|
||||
{{- dict "Class" "fa-solid fa-tags fa-fw me-1" | partial "plugin/icon.html" -}}
|
||||
{{- range $value := . -}}
|
||||
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
|
||||
{{- with $tag -}}
|
||||
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .LinkTitle }}</a>
|
||||
{{- end -}}
|
||||
{{- range $tagTerms -}}
|
||||
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .LinkTitle }}</a>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{{- $collectionTerms := .GetTerms "collections" -}}
|
||||
{{- range $collectionTerms -}}
|
||||
{{- $termLink := printf `<a href="%v">%v <span>%v・%v</span></span></a>`
|
||||
.RelPermalink
|
||||
(partial "function/escapeurl.html" .RelPermalink)
|
||||
(dict "Class" "fa-solid fa-layer-group fa-fw" | partial "plugin/icon.html")
|
||||
(T "collection")
|
||||
.LinkTitle
|
||||
|
||||
@@ -58,13 +58,11 @@
|
||||
|
||||
<div class="post-info-more">
|
||||
<section class="post-tags">
|
||||
{{- with .Params.tags -}}
|
||||
{{- $tagTerms := .GetTerms "tags" -}}
|
||||
{{- if $tagTerms -}}
|
||||
{{- dict "Class" "fa-solid fa-tags fa-fw me-1" | partial "plugin/icon.html" -}}
|
||||
{{- range $value := . -}}
|
||||
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
|
||||
{{- with $tag -}}
|
||||
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .LinkTitle }}</a>
|
||||
{{- end -}}
|
||||
{{- range $tagTerms -}}
|
||||
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .LinkTitle }}</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</section>
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
{{- $categories := slice -}}
|
||||
{{- range .Params.categories -}}
|
||||
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
||||
{{- range .GetTerms "categories" -}}
|
||||
{{- $categories = $categories | append (
|
||||
printf `<a href="%v" class="post-category" title="%v">%v %v</a>`
|
||||
(partial "function/escapeurl.html" $category.RelPermalink)
|
||||
(printf "%v - %v" (T "category") $category.LinkTitle)
|
||||
(partial "function/escapeurl.html" .RelPermalink)
|
||||
(printf "%v - %v" (T "category") .LinkTitle)
|
||||
(dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html")
|
||||
$category.LinkTitle
|
||||
.LinkTitle
|
||||
) -}}
|
||||
{{- end -}}
|
||||
{{- $categoriesStr := delimit $categories " " -}}
|
||||
|
||||
{{- $collections := slice -}}
|
||||
{{- range .Params.collections -}}
|
||||
{{- $collection := partialCached "function/path.html" . . | printf "/collections/%v" | $.Site.GetPage -}}
|
||||
{{- range .GetTerms "collections" -}}
|
||||
{{- $collections = $collections | append (
|
||||
printf `<a href="%v" class="post-collection" title="%v">%v %v</a>`
|
||||
(partial "function/escapeurl.html" $collection.RelPermalink)
|
||||
(printf "%v - %v" (T "collection") $collection.LinkTitle)
|
||||
(partial "function/escapeurl.html" .RelPermalink)
|
||||
(printf "%v - %v" (T "collection") .LinkTitle)
|
||||
(dict "Class" "fa-solid fa-layer-group fa-fw" | partial "plugin/icon.html")
|
||||
$collection.LinkTitle
|
||||
.LinkTitle
|
||||
) -}}
|
||||
{{- end -}}
|
||||
{{- $collectionStr := delimit $collections " " -}}
|
||||
|
||||
Reference in New Issue
Block a user