⚡ Improve site generate speed with use partialCached
function.
This commit is contained in:
parent
ad271c1c20
commit
12fbc945bc
@ -1,4 +1,6 @@
|
|||||||
{{- partial "init.html" . -}}
|
{{- range $k, $v := (partialCached "init.html" .) -}}
|
||||||
|
{{- $.Scratch.Set $k $v -}}
|
||||||
|
{{- end -}}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{ .Site.LanguageCode }}">
|
<html lang="{{ .Site.LanguageCode }}">
|
||||||
|
|
||||||
@ -28,13 +30,13 @@
|
|||||||
<!-- Submenu,Content,Comment -->
|
<!-- Submenu,Content,Comment -->
|
||||||
{{- block "main" . }}{{- end }}
|
{{- block "main" . }}{{- end }}
|
||||||
{{- if .IsPage }}
|
{{- if .IsPage }}
|
||||||
{{- partial "comments.html" . }}
|
{{- partialCached "comments.html" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="footer-inner">
|
<div class="footer-inner">
|
||||||
{{- partial "footer.html" . }}
|
{{- partialCached "footer.html" . }}
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
@ -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" -}}
|
{{- errorf "Because that use SCSS framework in Hugo NexT, Please download Hugo extended version on offical site: https://github.com/gohugoio/hugo/releases" -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- .Scratch.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) -}}
|
{{- $globalVars := newScratch -}}
|
||||||
{{- .Scratch.Set "catsCount" (len .Site.Taxonomies.categories) -}}
|
|
||||||
{{- .Scratch.Set "tagsCount" (len .Site.Taxonomies.tags) -}}
|
{{- $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 -}}
|
{{- $vendor := .Site.Params.vendors.plugins -}}
|
||||||
{{- $router := index .Site.Data.resources.vendors $vendor -}}
|
{{- $router := index .Site.Data.resources.vendors $vendor -}}
|
||||||
{{- .Scratch.Set "router" $router -}}
|
{{- $globalVars.Set "router" $router -}}
|
||||||
|
|
||||||
|
{{- return $globalVars.Values -}}
|
||||||
|
Loading…
Reference in New Issue
Block a user