From 03834fb1baa2dde9a5ef9bbe3a691ddca4354c97 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Mon, 11 Oct 2021 09:52:24 -0500 Subject: [PATCH] Add caching to some partials that don't change much --- layouts/_default/_markup/render-heading.html | 2 +- layouts/_default/baseof.html | 13 ++----------- layouts/_default/list.html | 8 ++++---- layouts/_default/single.html | 2 +- layouts/_default/summary.html | 4 ++-- layouts/partials/post-metadata.html | 12 ++++++------ layouts/partials/top.html | 10 ++++++++++ 7 files changed, 26 insertions(+), 25 deletions(-) create mode 100644 layouts/partials/top.html diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index 3644bda..00c4802 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -2,7 +2,7 @@ {{ .Text | safeHTML }} - {{ partial "icon.html" "link" }} + {{ partialCached "icon.html" "link" "link" }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 088b260..323b449 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,20 +1,11 @@ -{{ partial "credit.html" }} +{{ partialCached "credit.html" . }} {{- partial "head.html" . -}}
-

- {{ .Site.Title | markdownify }} -

- - + {{ partialCached "top.html" . }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index b6adf80..000fc89 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,23 +1,23 @@ {{ define "main" }} {{ if or (eq .Kind "term") (eq .Kind "taxonomy") }}

- {{ partial "icon.html" "filter" }} + {{ partialCached "icon.html" "filter" "filter" }} Filtering for "{{ .Title }}" {{ if eq .Kind "term" }} {{ with .OutputFormats.Get "rss" }} - {{ partial "icon.html" "rss" }} + {{ partialCached "icon.html" "rss" "rss" }} {{ end }} {{ end }}

{{ else }}

- {{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }} + {{ with .Params.icon }}{{ partialCached "icon.html" . . }}{{ end }} {{ .Title | markdownify }} {{ with .OutputFormats.Get "rss" }} - {{ partial "icon.html" "rss" }} + {{ partialCached "icon.html" "rss" "rss" }} {{ end }}

diff --git a/layouts/_default/single.html b/layouts/_default/single.html index c22c4a1..441d2c8 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,7 +2,7 @@

{{ .Title | markdownify }} - {{ if .Draft }}{{ partial "icon.html" "edit" }}{{ end }} + {{ if .Draft }}{{ partialCached "icon.html" "edit" "edit" }}{{ end }}

diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 895980f..741e4cf 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -1,8 +1,8 @@

- {{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }} + {{ with .Parent.Params.icon }}{{ partialCached "icon.html" . . }}{{ end }} {{ .Title | markdownify }} - {{ if .Draft }}{{ partial "icon.html" "edit" }}{{ end }} + {{ if .Draft }}{{ partialCached "icon.html" "edit" "edit" }}{{ end }}

{{ partial "post-metadata.html" . }} diff --git a/layouts/partials/post-metadata.html b/layouts/partials/post-metadata.html index c39e835..8c73332 100644 --- a/layouts/partials/post-metadata.html +++ b/layouts/partials/post-metadata.html @@ -2,7 +2,7 @@