chore: replace .Scratch with .Store (#818)

This commit is contained in:
Ludovic Fernandez
2025-09-03 16:37:18 +02:00
committed by GitHub
parent 184ee25011
commit 334158af7a
5 changed files with 8 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
{{/* Article navigation on the footer of the article */}} {{/* Article navigation on the footer of the article */}}
{{- $reversePagination := .Scratch.Get "reversePagination" | default false -}} {{- $reversePagination := .Store.Get "reversePagination" | default false -}}
{{- $prev := cond $reversePagination .PrevInSection .NextInSection -}} {{- $prev := cond $reversePagination .PrevInSection .NextInSection -}}
{{- $next := cond $reversePagination .NextInSection .PrevInSection -}} {{- $next := cond $reversePagination .NextInSection .PrevInSection -}}

View File

@@ -1,4 +1,4 @@
{{- $enableFooterSwitches := .Scratch.Get "enableFooterSwitches" | default false -}} {{- $enableFooterSwitches := .Store.Get "enableFooterSwitches" | default false -}}
{{- $displayThemeToggle := site.Params.theme.displayToggle | default true -}} {{- $displayThemeToggle := site.Params.theme.displayToggle | default true -}}
{{- $footerSwitchesVisible := and $enableFooterSwitches (or hugo.IsMultilingual $displayThemeToggle) -}} {{- $footerSwitchesVisible := and $enableFooterSwitches (or hugo.IsMultilingual $displayThemeToggle) -}}
{{- $copyrightSectionVisible := or (.Site.Params.footer.displayPoweredBy | default true) .Site.Params.footer.displayCopyright -}} {{- $copyrightSectionVisible := or (.Site.Params.footer.displayPoweredBy | default true) .Site.Params.footer.displayCopyright -}}

View File

@@ -30,7 +30,7 @@
<!-- Sidebar on large screen --> <!-- Sidebar on large screen -->
{{- if $disableSidebar -}} {{- if $disableSidebar -}}
{{- if $displayPlaceholder }}<div class="hx:max-xl:hidden hx:h-0 hx:w-64 hx:shrink-0"></div>{{ end -}} {{- if $displayPlaceholder }}<div class="hx:max-xl:hidden hx:h-0 hx:w-64 hx:shrink-0"></div>{{ end -}}
{{ .context.Scratch.Set "enableFooterSwitches" true }} {{ .context.Store.Set "enableFooterSwitches" true }}
{{- else -}} {{- else -}}
<ul class="hx:flex hx:flex-col hx:gap-1 hx:max-md:hidden"> <ul class="hx:flex hx:flex-col hx:gap-1 hx:max-md:hidden">
{{ template "sidebar-main" (dict "context" $navRoot "page" $context "pageURL" $pageURL) }} {{ template "sidebar-main" (dict "context" $navRoot "page" $context "pageURL" $pageURL) }}

View File

@@ -40,7 +40,7 @@
</div> </div>
{{- partial "components/last-updated.html" . -}} {{- partial "components/last-updated.html" . -}}
{{- if (site.Params.blog.article.displayPagination | default true) -}} {{- if (site.Params.blog.article.displayPagination | default true) -}}
{{- .Scratch.Set "reversePagination" (.Params.reversePagination | default true) -}} {{- .Store.Set "reversePagination" (.Params.reversePagination | default true) -}}
{{- partial "components/pager.html" . -}} {{- partial "components/pager.html" . -}}
{{ end }} {{ end }}
{{- partial "components/comments.html" . -}} {{- partial "components/comments.html" . -}}

View File

@@ -14,15 +14,15 @@
{{ end }} {{ end }}
{{ if not $.Section }} {{ if not $.Section }}
{{ $sections := .Site.Params.rss.sections | default (slice "blog") }} {{ $sections := .Site.Params.rss.sections | default (slice "blog") }}
{{ .Scratch.Set "rssPages" (first 50 (where $.Site.RegularPages "Type" "in" $sections )) }} {{ .Store.Set "rssPages" (first 50 (where $.Site.RegularPages "Type" "in" $sections )) }}
{{ else }} {{ else }}
{{ if $.Parent.IsHome }} {{ if $.Parent.IsHome }}
{{ .Scratch.Set "rssPages" (first 50 (where $.Site.RegularPages "Type" $.Section )) }} {{ .Store.Set "rssPages" (first 50 (where $.Site.RegularPages "Type" $.Section )) }}
{{ else }} {{ else }}
{{ .Scratch.Set "rssPages" (first 50 $.Pages) }} {{ .Store.Set "rssPages" (first 50 $.Pages) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range (.Scratch.Get "rssPages") }} {{ range (.Store.Get "rssPages") }}
<item> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>