Improve site generate speed with use partialCached function.

This commit is contained in:
凡梦星尘
2022-07-20 15:42:01 +08:00
parent ad271c1c20
commit 12fbc945bc
2 changed files with 14 additions and 7 deletions

View File

@@ -5,9 +5,14 @@
{{- errorf "Because that use SCSS framework in Hugo NexT, Please download Hugo extended version on offical site: https://github.com/gohugoio/hugo/releases" -}}
{{- end }}
{{- .Scratch.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) -}}
{{- .Scratch.Set "catsCount" (len .Site.Taxonomies.categories) -}}
{{- .Scratch.Set "tagsCount" (len .Site.Taxonomies.tags) -}}
{{- $globalVars := newScratch -}}
{{- $globalVars.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) -}}
{{- $globalVars.Set "catsCount" (len .Site.Taxonomies.categories) -}}
{{- $globalVars.Set "tagsCount" (len .Site.Taxonomies.tags) -}}
{{- $vendor := .Site.Params.vendors.plugins -}}
{{- $router := index .Site.Data.resources.vendors $vendor -}}
{{- .Scratch.Set "router" $router -}}
{{- $globalVars.Set "router" $router -}}
{{- return $globalVars.Values -}}