From 9a64b7a6f10c8e9652ad3ff3dff92f35ceef6ffb Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Thu, 17 Sep 2020 21:46:48 +0200 Subject: [PATCH 1/4] feat: partialCached for PhotoSwipe HTML --- layouts/_default/single.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index edf53fb..4ae562e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,5 +8,5 @@ {{ partialCached "footer/footer" . }} - {{ partial "article/components/photoswipe" . }} + {{ partialCached "article/components/photoswipe" . }} {{ end }} \ No newline at end of file From cf6502c31140214236ea7f8578ccd6ad9d2b6d2c Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Thu, 17 Sep 2020 21:52:06 +0200 Subject: [PATCH 2/4] feat: add partialCached to helper/image invocation Using .RelPermalink as key for cache --- layouts/_default/term.html | 2 +- layouts/partials/article-list/compact.html | 2 +- layouts/partials/article-list/default.html | 2 +- layouts/partials/article-list/tile.html | 2 +- layouts/partials/article/components/details.html | 2 +- layouts/partials/article/components/header.html | 2 +- layouts/partials/head/opengraph/provider/base.html | 2 +- layouts/partials/head/opengraph/provider/twitter.html | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 0d0a35f..91021c4 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -9,7 +9,7 @@ {{ end }} - {{ $image := partial "helper/image" (dict "Context" . "Type" "taxonomy") }} + {{ $image := partialCached "helper/image" (dict "Context" . "Type" "taxonomy") .RelPermalink }} {{ if $image.exists }}
{{ if $image.resource }} diff --git a/layouts/partials/article-list/compact.html b/layouts/partials/article-list/compact.html index 1a71318..344086e 100644 --- a/layouts/partials/article-list/compact.html +++ b/layouts/partials/article-list/compact.html @@ -12,7 +12,7 @@
- {{ $image := partial "helper/image" (dict "Context" . "Type" "articleList") }} + {{ $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink }} {{ if $image.exists }}
diff --git a/layouts/partials/article-list/default.html b/layouts/partials/article-list/default.html index ccbfba5..29e9daa 100644 --- a/layouts/partials/article-list/default.html +++ b/layouts/partials/article-list/default.html @@ -1,4 +1,4 @@ -{{ $image := partial "helper/image" (dict "Context" . "Type" "articleList") }} +{{ $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink }}
{{ if $image.exists }}
diff --git a/layouts/partials/article-list/tile.html b/layouts/partials/article-list/tile.html index ea38a83..b846681 100644 --- a/layouts/partials/article-list/tile.html +++ b/layouts/partials/article-list/tile.html @@ -1,4 +1,4 @@ -{{ $image := partial "helper/image" (dict "Context" .context "Type" .Type) }} +{{ $image := partialCached "helper/image" (dict "Context" .context "Type" .Type) .context.RelPermalink }}
diff --git a/layouts/partials/article/components/details.html b/layouts/partials/article/components/details.html index 1b776be..89d5554 100644 --- a/layouts/partials/article/components/details.html +++ b/layouts/partials/article/components/details.html @@ -1,4 +1,4 @@ -{{ $image := partial "helper/image" (dict "Context" .) }} +{{ $image := partialCached "helper/image" (dict "Context" .) .RelPermalink }} {{ $context := . }}
{{ with $categories := .Params.categories }} diff --git a/layouts/partials/article/components/header.html b/layouts/partials/article/components/header.html index df7c764..1d2c7dc 100644 --- a/layouts/partials/article/components/header.html +++ b/layouts/partials/article/components/header.html @@ -1,5 +1,5 @@
- {{ $image := partial "helper/image" (dict "Context" . "Type" "article") }} + {{ $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink }} {{ if $image.exists }}
diff --git a/layouts/partials/head/opengraph/provider/base.html b/layouts/partials/head/opengraph/provider/base.html index ea7f084..67c8cb5 100644 --- a/layouts/partials/head/opengraph/provider/base.html +++ b/layouts/partials/head/opengraph/provider/base.html @@ -37,7 +37,7 @@ {{- end -}} {{- end -}} -{{ $image := partial "helper/image" (dict "Context" . "Type" "opengraph") }} +{{ $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink }} {{- if $image.exists -}} {{- end -}} \ No newline at end of file diff --git a/layouts/partials/head/opengraph/provider/twitter.html b/layouts/partials/head/opengraph/provider/twitter.html index 707ae2b..6964156 100644 --- a/layouts/partials/head/opengraph/provider/twitter.html +++ b/layouts/partials/head/opengraph/provider/twitter.html @@ -8,7 +8,7 @@ -{{- $image := partial "helper/image" (dict "Context" . "Type" "opengraph") -}} +{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink -}} {{- if $image.exists -}} From 8f0d420d2447d37582f9854f142413add40acb30 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Thu, 17 Sep 2020 21:59:57 +0200 Subject: [PATCH 3/4] feat: add partialCached for data/title data/description --- layouts/partials/head/head.html | 4 ++-- layouts/partials/head/opengraph/provider/base.html | 4 ++-- layouts/partials/head/opengraph/provider/twitter.html | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html index 5ab35dd..9df2ea1 100644 --- a/layouts/partials/head/head.html +++ b/layouts/partials/head/head.html @@ -2,10 +2,10 @@ - {{- $description := partial "data/description" . -}} + {{- $description := partialCached "data/description" . .RelPermalink -}} - {{- $title := partial "data/title" . -}} + {{- $title := partialCached "data/title" . .RelPermalink -}} {{ $title }} diff --git a/layouts/partials/head/opengraph/provider/base.html b/layouts/partials/head/opengraph/provider/base.html index 67c8cb5..10dddb9 100644 --- a/layouts/partials/head/opengraph/provider/base.html +++ b/layouts/partials/head/opengraph/provider/base.html @@ -1,5 +1,5 @@ -{{- $title := partial "data/title" . -}} -{{- $description := partial "data/description" . -}} +{{- $title := partialCached "data/title" . .RelPermalink -}} +{{- $description := partialCached "data/description" . .RelPermalink -}} diff --git a/layouts/partials/head/opengraph/provider/twitter.html b/layouts/partials/head/opengraph/provider/twitter.html index 6964156..a33757b 100644 --- a/layouts/partials/head/opengraph/provider/twitter.html +++ b/layouts/partials/head/opengraph/provider/twitter.html @@ -2,8 +2,8 @@ {{- end -}} -{{- $title := partial "data/title" . -}} -{{- $description := partial "data/description" . -}} +{{- $title := partialCached "data/title" . .RelPermalink -}} +{{- $description := partialCached "data/description" . .RelPermalink -}} From bad33e19aea83c92e18ea9ebe9871d94063c98c0 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Thu, 17 Sep 2020 22:09:15 +0200 Subject: [PATCH 4/4] feat(post/single): add partialCached for PhotoSwipe HTML Forgot to add it --- layouts/post/single.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/post/single.html b/layouts/post/single.html index aabeee7..8cd32de 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -17,5 +17,5 @@ {{ partialCached "footer/footer" . }} - {{- partial "article/components/photoswipe.html" . -}} + {{- partialCached "article/components/photoswipe.html" . -}} {{ end }} \ No newline at end of file