Perf: optimize code

This commit is contained in:
Cell
2022-11-20 18:47:42 +08:00
parent d31215044d
commit ffb3888414
6 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -43,7 +43,7 @@
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (printf `<a href="%v">%v %v</a>` (replace $category.RelPermalink "#" "%23") (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}}
{{- $categories = $categories | append (printf `<a href="%v">%v %v</a>` (partial "function/escapeurl.html" $category.RelPermalink) (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&ensp;" -}}
&nbsp;<span class="post-category">
@@ -70,7 +70,7 @@
{{- range $value := . -}}
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
{{- with $tag -}}
<a href='{{ replace .RelPermalink "#" "%23" }}' class="post-tag">{{ .Title }}</a>
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .Title }}</a>
{{- end -}}
{{- end -}}
</div>