🐛 Fix: use function to get params replace of .Scatch (#420)

This commit is contained in:
Cell
2024-02-23 20:50:52 +08:00
parent a9fd15e47d
commit 2ea592b4a3
27 changed files with 28 additions and 27 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{{- /* Read the config and format */ -}}
{{- $params := .Page.Scratch.Get "params" -}}
{{- $params := partial "function/params.html" -}}
{{- $h1Format := $params.heading.number.format.h1 | default "{title}" -}}
{{- $h2Format := $params.heading.number.format.h2 | default "{h2} {title}" -}}
{{- $h3Format := $params.heading.number.format.h3 | default "{h2}.{h3} {title}" -}}
+1 -1
View File
@@ -6,6 +6,6 @@
</figcaption>
</figure>
{{- else -}}
{{- $linked := (eq (.Page.Scratch.Get "params").lightgallery "force") | or (ne .Title "") -}}
{{- $linked := (eq (partial "function/params.html").lightgallery "force") | or (ne .Title "") -}}
{{- dict "Src" .Destination "Alt" .Text "Title" .Title "Linked" $linked "Responsive" true | partial "plugin/image.html" -}}
{{- end -}}
+1 -1
View File
@@ -21,7 +21,7 @@
<script>(window.localStorage?.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('data-theme', 'dark');</script>
{{- /* Body wrapper */ -}}
<div class="wrapper" data-page-style="{{ (.Scratch.Get `params`).pageStyle | default `normal` }}">
<div class="wrapper" data-page-style="{{ (partial `function/params.html`).pageStyle | default `normal` }}">
{{- partial "header.html" . -}}
{{- partial "breadcrumb.html" . -}}
{{- $toc := .Scratch.Get "toc" -}}
+1 -1
View File
@@ -4,7 +4,7 @@
{{- end -}}
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}
{{- $params := partial "function/params.html" -}}
<article class="page single special">
<div class="header">
{{- /* Title */ -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- $params := .Scratch.Get "params" -}}
{{- $params := partial "function/params.html" -}}
{{- $author := .Store.Get "author" -}}
# {{ .Title }}