mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-09-02 19:52:40 +00:00
🐛 Fix: use function to get params replace of .Scatch (#420)
This commit is contained in:
@@ -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}" -}}
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -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" -}}
|
||||
|
||||
@@ -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,4 +1,4 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $author := .Store.Get "author" -}}
|
||||
# {{ .Title }}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{{ end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
<article class="page single special friends">
|
||||
<div class="header">
|
||||
{{- /* Title */ -}}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $profile := .Site.Params.home.profile -}}
|
||||
{{- $posts := .Site.Params.home.posts -}}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end }}
|
||||
{{- range .Scratch.Get "mainSectionPages" | first (.Site.Params.home.rss | default 10) -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- if $params.password | or $params.hiddenFromRss }}{{ continue }}{{ end -}}
|
||||
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
<article class="page single special friends">
|
||||
<div class="header">
|
||||
{{- /* Title */ -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $config := (.Scratch.Get "this").config -}}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $params := page.Params | merge site.Params.page -}}
|
||||
{{- return $params -}}
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
<meta name="author" content="{{ .Site.Params.author.name }}">
|
||||
<meta name="author-link" content="{{ .Site.Params.author.link }}">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- with .Site.Params.verification.google -}}
|
||||
<meta name="google-site-verification" content="{{ . }}" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{- /* FixIt theme environment detection */ -}}
|
||||
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{- $cdn := .Site.Params.cdn -}}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{{- .Scratch.Set "version" "v0.3.3-RC" -}}
|
||||
{{- .Scratch.Set "params" (.Params | merge .Site.Params.page) -}}
|
||||
{{- .Scratch.Set "this" (dict "version" (.Scratch.Get "version") | dict "config") -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- /* FixIt theme patches */ -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- /* Toc data patch */ -}}
|
||||
{{- $toc := $params.toc -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $params := page.Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $class := .Class | default "" -}}
|
||||
{{- $style := "" -}}
|
||||
{{- $loading := .Loading | default "lazy" -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $share := (.Scratch.Get "params").share | default dict -}}
|
||||
{{- $share := (partial "function/params.html").share | default dict -}}
|
||||
|
||||
{{- if $share.enable -}}
|
||||
{{- /* 001: Twitter */ -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- /* Collection List */ -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if .Params.collections | and $params.collectionList | and (not $params.password) -}}
|
||||
{{- $collectionTerms := .GetTerms "collections" -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- /* Collection Navigation */ -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if .Params.collections | and $params.collectionNavigation | and (not $params.password) -}}
|
||||
{{- $collectionTerms := .GetTerms "collections" -}}
|
||||
|
||||
@@ -325,7 +325,7 @@
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- /* lightgallery for Artalk and Twikoo */ -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- if not $params.lightgallery | and (($artalk.enable | and $artalk.lightgallery) | or ($twikoo.enable | and $twikoo.lightgallery)) -}}
|
||||
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $expirationReminder := $params.expirationReminder | default dict -}}
|
||||
|
||||
{{- if $expirationReminder.enable -}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if $params.password -}}
|
||||
{{- $msg := (.Scratch.Get "params").message | default (T "single.encryptedMessage") -}}
|
||||
{{- $msg := $params.message | default (T "single.encryptedMessage") -}}
|
||||
{{- $loading := resources.Get "images/loading.svg" | minify -}}
|
||||
<div class="fixit-decryptor-container">
|
||||
<img class="fixit-decryptor-loading" src="{{ $loading.RelPermalink }}" alt="decryptor loading" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- /* Git info */ -}}
|
||||
{{- $gitRepo := "" -}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{- /* Related Content */ -}}
|
||||
{{- /* https://gohugo.io/content-management/related/ */ -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if $params.related.enable | and (not $params.password) -}}
|
||||
{{- $posts := .Scratch.Get "mainSectionPages" -}}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $toc := .Scratch.Get "toc" -}}
|
||||
{{- $tocEmpty := eq .TableOfContents `<nav id="TableOfContents"></nav>` -}}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $mapbox := (.Page.Scratch.Get "params").mapbox | default dict -}}
|
||||
{{- $mapbox := (partial "function/params.html").mapbox | default dict -}}
|
||||
|
||||
{{- $lng := cond .IsNamedParams (.Get "lng") (.Get 0) -}}
|
||||
{{- $lat := cond .IsNamedParams (.Get "lat") (.Get 1) -}}
|
||||
|
||||
Reference in New Issue
Block a user