From b1866d62dfb653a75653cc0f767189db46ca7e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Fri, 11 Nov 2022 13:43:23 +0100 Subject: [PATCH] theme: cache page-meta.hugo #380 --- layouts/404.html | 2 +- layouts/_default/index.json | 2 +- layouts/_default/index.search.js | 2 +- layouts/_default/rss.xml | 2 +- layouts/_default/sitemap.xml | 2 +- layouts/partials/_main.hugo | 2 +- layouts/partials/_taxonomy.html | 2 +- layouts/partials/page-meta.hugo | 1 - 8 files changed, 7 insertions(+), 8 deletions(-) diff --git a/layouts/404.html b/layouts/404.html index 6638601d97..fb12afbad5 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,4 +1,4 @@ -{{- partial "page-meta.hugo" . }} +{{- partialCached "page-meta.hugo" . . }} diff --git a/layouts/_default/index.json b/layouts/_default/index.json index c6bcdddb22..c7f0d2dbcb 100644 --- a/layouts/_default/index.json +++ b/layouts/_default/index.json @@ -1,4 +1,4 @@ -{{- partial "page-meta.hugo" . }} +{{- partialCached "page-meta.hugo" . . }} {{- $pages := slice }} {{- range .Site.Pages }} {{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }} diff --git a/layouts/_default/index.search.js b/layouts/_default/index.search.js index 216a1a343f..a7f5c37908 100644 --- a/layouts/_default/index.search.js +++ b/layouts/_default/index.search.js @@ -1,4 +1,4 @@ -{{- partial "page-meta.hugo" . }} +{{- partialCached "page-meta.hugo" . . }} {{- $pages := slice }} {{- range .Site.Pages }} {{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index d502deb3f2..61085bc86d 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,4 +1,4 @@ -{{- partial "page-meta.hugo" . }} +{{- partialCached "page-meta.hugo" . . }} {{- $pages := .Page.Pages }} {{- if .Page.IsHome }} {{- $pages = .Page.Sections }} diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml index 1d95c8bf20..42f5fd98c9 100644 --- a/layouts/_default/sitemap.xml +++ b/layouts/_default/sitemap.xml @@ -1,4 +1,4 @@ -{{- partial "page-meta.hugo" . }} +{{- partialCached "page-meta.hugo" . . }} {{- printf "" | safeHTML }} {{- range .Data.Pages }} diff --git a/layouts/partials/_main.hugo b/layouts/partials/_main.hugo index 841324685e..9e812b6c05 100644 --- a/layouts/partials/_main.hugo +++ b/layouts/partials/_main.hugo @@ -1,4 +1,4 @@ -{{- partial "page-meta.hugo" . }} +{{- partialCached "page-meta.hugo" . . }} {{- partial "output-partial.hugo" (dict "base" "header" "page" . "parameter" .) }} {{- if not .File }} {{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "initial" "page" . "parameter" .)))) }} diff --git a/layouts/partials/_taxonomy.html b/layouts/partials/_taxonomy.html index b9a5e98ef2..d9b966f34c 100644 --- a/layouts/partials/_taxonomy.html +++ b/layouts/partials/_taxonomy.html @@ -1,4 +1,4 @@ -{{- partial "page-meta.hugo" . }} +{{- partialCached "page-meta.hugo" . . }} {{- partial "header.html" . }}
{{- $page := . }} diff --git a/layouts/partials/page-meta.hugo b/layouts/partials/page-meta.hugo index b1d134cb77..ddf0144b5b 100644 --- a/layouts/partials/page-meta.hugo +++ b/layouts/partials/page-meta.hugo @@ -5,7 +5,6 @@ {{- $currentNode.Scratch.Delete "relearnIsHiddenNode" }}{{/* the node itself is flagged as hidden */}} {{- $currentNode.Scratch.Delete "relearnIsHiddenStem" }}{{/* the node or one of its parents is flagged as hidden */}} {{- $currentNode.Scratch.Delete "relearnIsHiddenFrom" }}{{/* the node is hidden from the current page */}} -{{- $currentNode.Scratch.Delete (printf "%sWantsMathJax" (partial "output-format.hugo" $currentNode)) }} {{- $wantsMathjax := or (and (ne $currentNode.Params.disableMathjax nil) (not $currentNode.Params.disableMathjax)) (and (ne .Site.Params.disableMathjax nil) (not .Site.Params.disableMathjax)) }} {{- if $wantsMathjax }} {{- $currentNode.Store.Set "hasMathJax" true }}