mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
♻️ Refactor: global/site/page scope state management (#610)
* ⚡ Perf: adjust global/site scope state management * ⚡ Perf: adjust page scope state management
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
|
||||
{{- if $ordered -}}
|
||||
{{- /* Set the count for child level to 0 */ -}}
|
||||
{{- .Page.Scratch.SetInMap "heading-counter" (string (add $level 1)) 0 -}}
|
||||
{{- .Page.Store.SetInMap "heading-counter" (string (add $level 1)) 0 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $attrs := "" }}
|
||||
@@ -50,9 +50,9 @@
|
||||
{{- $title := .Text -}}
|
||||
{{- if $ordered -}}
|
||||
{{- /* Add 1 to the current level */ -}}
|
||||
{{- $headingMap := .Page.Scratch.Get "heading-counter" -}}
|
||||
{{- $headingMap := .Page.Store.Get "heading-counter" -}}
|
||||
{{- $count := (string $level) | index $headingMap | int | add 1 -}}
|
||||
{{- .Page.Scratch.SetInMap "heading-counter" (string $level) $count -}}
|
||||
{{- .Page.Store.SetInMap "heading-counter" (string $level) $count -}}
|
||||
|
||||
{{- /* Get the counters for all levels */ -}}
|
||||
{{- $h1 := "1" | index $headingMap | int | string -}}
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
{{- $noop := .WordCount -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $config := (.Scratch.Get "this").config -}}
|
||||
{{- $config = dict "version" (.Scratch.Get "version") | merge $config -}}
|
||||
{{- $cdn := .Site.Store.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
|
||||
{{- $config := (.Store.Get "this").config -}}
|
||||
{{- $config = dict "version" (hugo.Store.Get "version") | merge $config -}}
|
||||
|
||||
{{- /* Search */ -}}
|
||||
{{- if .Site.Params.search | and .Site.Params.search.enable -}}
|
||||
{{- $search := .Site.Params.search -}}
|
||||
{{- /* TODO update "lib/autocomplete-js/umd/index.production.js" */ -}}
|
||||
{{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "assets.noResultsFound") | dict "search" | merge $config -}}
|
||||
{{- if eq $search.type "algolia" -}}
|
||||
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
|
||||
{{- else if eq $search.type "fuse" -}}
|
||||
{{- with .Site.Home.OutputFormats.Get "search" -}}
|
||||
{{- $config = dict "type" "fuse" "fuseIndexURL" .RelPermalink | dict "search" | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- $source := $cdn.fuseJS | default "lib/fuse/fuse.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "isCaseSensitive" $search.fuse.isCaseSensitive "minMatchCharLength" $search.fuse.minMatchCharLength "findAllMatches" $search.fuse.findAllMatches "location" $search.fuse.location "threshold" $search.fuse.threshold "distance" $search.fuse.distance "ignoreLocation" $search.fuse.ignoreLocation "useExtendedSearch" $search.fuse.useExtendedSearch "ignoreFieldNorm" $search.fuse.ignoreFieldNorm | dict "search" | merge $config -}}
|
||||
{{- else if eq $search.type "cse" -}}
|
||||
{{- $config = dict "type" "cse" | dict "search" | merge $config -}}
|
||||
@@ -40,26 +41,26 @@
|
||||
{{- /* instant.page */ -}}
|
||||
{{- if $params.instantPage -}}
|
||||
{{- $source := $cdn.instantPage | default "lib/instant-page/instantpage.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Async" true "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* twemoji */ -}}
|
||||
{{- if $params.twemoji -}}
|
||||
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "twemoji" true | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* lightgallery */ -}}
|
||||
{{- if $params.lightgallery | or (eq $params.lightgallery "force") -}}
|
||||
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/plugins/thumbnail/lg-thumbnail.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/plugins/zoom/lg-zoom.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "lightgallery" true | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -78,14 +79,14 @@
|
||||
{{- /* Sharer.js */ -}}
|
||||
{{- if $params.share.enable -}}
|
||||
{{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* TypeIt */ -}}
|
||||
{{- if .Store.Get "hasTyped" -}}
|
||||
{{- $typeit := .Site.Params.typeit -}}
|
||||
{{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "loop" $typeit.loop | dict "typeit" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -95,11 +96,11 @@
|
||||
{{- /* KaTeX */ -}}
|
||||
{{- if (eq $math.type "katex") | and (.Store.Get "hasKaTeX") -}}
|
||||
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- /* Copy-tex extension */ -}}
|
||||
{{- if $math.katex.copyTex -}}
|
||||
{{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -123,7 +124,7 @@
|
||||
{{- if not hugo.IsProduction -}}
|
||||
{{- $options = dict "sourceMap" "external" | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" $source "Build" $options "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Build" $options "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -142,7 +143,7 @@
|
||||
{{- /* ECharts */ -}}
|
||||
{{- if .Store.Get "hasEcharts" -}}
|
||||
{{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $lightTheme := resources.Get "lib/echarts/theme/light.yml" | transform.Unmarshal -}}
|
||||
{{- $darkTheme := resources.Get "lib/echarts/theme/dark.yml" | transform.Unmarshal -}}
|
||||
{{- $config = dict "lightTheme" $lightTheme "darkTheme" $darkTheme | dict "echarts" | merge $config -}}
|
||||
@@ -151,10 +152,10 @@
|
||||
{{- /* Mapbox GL */ -}}
|
||||
{{- if .HasShortcode "mapbox" -}}
|
||||
{{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.css" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint "Preload" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source = $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -162,23 +163,23 @@
|
||||
{{- if .HasShortcode "music" -}}
|
||||
{{- /* APlayer */ -}}
|
||||
{{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}}
|
||||
{{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* MetingJS */ -}}
|
||||
{{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Cookie Consent */ -}}
|
||||
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
|
||||
{{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}}
|
||||
{{- $cookieconsentConfig = .Site.Params.cookieconsent | merge $cookieconsentConfig -}}
|
||||
{{- $cookieconsentConfig = dict "message" ($cookieconsentConfig.content.message | default (T "assets.cookieconsentMessage")) "dismiss" ($cookieconsentConfig.content.dismiss | default (T "assets.cookieconsentDismiss")) "link" ($cookieconsentConfig.content.link | default (T "assets.cookieconsentLink")) | dict "content" | merge $cookieconsentConfig -}}
|
||||
@@ -188,14 +189,14 @@
|
||||
{{- /* PanguJS */ -}}
|
||||
{{- if eq .Site.Params.pangu.enable true -}}
|
||||
{{- $source := $cdn.panguJS | default "lib/pangu/pangu.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "pangu" .Site.Params.pangu | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Watermark */ -}}
|
||||
{{- if eq .Site.Params.watermark.enable true -}}
|
||||
{{- $source := $cdn.cellWatermarkJS | default "lib/cell-watermark/watermark.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- /* Hugo bug: case insensitive for `.Site.Params` */ -}}
|
||||
{{- $config = dict "watermark" .Site.Params.watermark | merge $config -}}
|
||||
{{- end -}}
|
||||
@@ -207,27 +208,27 @@
|
||||
{{- $cryptoEncBase64JS := $cdn.cryptoEncBase64JS | default "lib/crypto-js/enc-base64.js" -}}
|
||||
{{- $cryptoSha256JS := $cdn.cryptoSha256JS | default "lib/crypto-js/sha256.js" -}}
|
||||
{{- $xxhashWasmJS := $cdn.xxhashWasmJS | default "lib/xxhash-wasm/xxhash-wasm.js" -}}
|
||||
{{- dict "Source" $cryptoCoreJS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $cryptoEncBase64JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $cryptoSha256JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $xxhashWasmJS "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $cryptoCoreJS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $cryptoEncBase64JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $cryptoSha256JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $xxhashWasmJS "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- /* Decryption script */ -}}
|
||||
{{- $options := dict "targetPath" "js/fixit-decryptor.min.js" "minify" hugo.IsProduction -}}
|
||||
{{- if not hugo.IsProduction -}}
|
||||
{{- $options = dict "sourceMap" "external" | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" (resources.Get "js/fixit-decryptor.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" (resources.Get "js/fixit-decryptor.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "all" (isset $params "password") "shortcode" ($encryptPartial | default false) | dict "encryption" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 不蒜子 */ -}}
|
||||
{{- if .Site.Params.busuanzi.enable | and hugo.IsProduction -}}
|
||||
{{- $source := .Site.Params.busuanzi.source | default "https://vercount.one/js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Site creation time */ -}}
|
||||
{{- $siteTime := .Scratch.Get "siteTime" -}}
|
||||
{{- $siteTime := .Site.Store.Get "siteTime" -}}
|
||||
{{- if $siteTime.enable -}}
|
||||
{{- with $siteTime.value -}}
|
||||
{{- $config = dict "siteTime" . | merge $config -}}
|
||||
@@ -261,11 +262,11 @@
|
||||
{{- $paceCSS = printf "%v/pace-theme-default.min.css" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" $paceJS "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $paceCSS "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $paceJS "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $paceCSS "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- /* To patch pace theme flat-top z-index error */ -}}
|
||||
{{- if eq $.Site.Params.pace.theme "flat-top" -}}
|
||||
{{- dict "Source" "lib/pace/pace-patch-flat-top.css" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" "lib/pace/pace-patch-flat-top.css" "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -273,18 +274,18 @@
|
||||
{{- partial "plugin/post-chat-ai.html" . -}}
|
||||
|
||||
{{- range $params.library.css -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Page" $ "Data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.js -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Store.Get "styleArr" -}}
|
||||
{{- $content := delimit . " " -}}
|
||||
{{- $path := substr (md5 $.RelPermalink) 0 8 | printf "css/%v" -}}
|
||||
{{- $options := printf "%v.min.css" $path | dict "targetPath" -}}
|
||||
{{- dict "Content" $content "Path" (printf "%v.scss" $path) "ToCSS" $options | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Content" $content "Path" (printf "%v.scss" $path) "ToCSS" $options | dict "Page" $ "Data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Config script */ -}}
|
||||
@@ -292,14 +293,14 @@
|
||||
{{- if hugo.IsServer -}}
|
||||
{{- $configJS = add $configJS "console.log('Page config:', window.config);" -}}
|
||||
{{- end -}}
|
||||
{{- $configJS | dict "Content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $configJS | dict "Content" | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* Theme script */ -}}
|
||||
{{- $options := dict "targetPath" "js/theme.min.js" "minify" hugo.IsProduction -}}
|
||||
{{- if not hugo.IsProduction -}}
|
||||
{{- $options = dict "sourceMap" "external" | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" (resources.Get "js/theme.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" (resources.Get "js/theme.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* Custom Assets */ -}}
|
||||
{{- block "custom-assets" . }}{{ end -}}
|
||||
@@ -310,20 +311,20 @@
|
||||
{{- if not hugo.IsProduction -}}
|
||||
{{- $options = dict "sourceMap" "inline" | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" . "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" . "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Store.Get "scriptArr" -}}
|
||||
{{- $content := delimit . "\n" -}}
|
||||
{{- $targetPath := substr (md5 $.RelPermalink) 0 8 | printf "js/%v.js" -}}
|
||||
{{- dict "Content" $content "Path" $targetPath "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Content" $content "Path" $targetPath "Defer" true | dict "Page" $ "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range (.Scratch.Get "this").style -}}
|
||||
{{- range (.Store.Get "this").style -}}
|
||||
{{- partial "plugin/style.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range (.Scratch.Get "this").script -}}
|
||||
{{- range (.Store.Get "this").script -}}
|
||||
{{- partial "plugin/script.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<userId>{{ .Site.Params.feed.follow.userId }}</userId>
|
||||
</follow_challenge>
|
||||
{{- end }}
|
||||
<generator>Hugo {{ hugo.Version }} & FixIt {{ .Version }}</generator>
|
||||
<generator>Hugo {{ hugo.Version }} & FixIt {{ hugo.Store.Get "version" }}</generator>
|
||||
<language>{{ .Site.Language.LanguageCode }}</language>{{ with .Site.Params.author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Params.author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Params.author.email }}
|
||||
<webMaster>{{ . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
{{- if ne $footerConfig.powered.enable false -}}
|
||||
<div class="footer-line powered{{ with $footerConfig.order.powered }} order-{{ . }}{{ end }}">
|
||||
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreferrer" title="Hugo %v">{hugoLogo}Hugo</a>` hugo.Version -}}
|
||||
{{- $theme := printf `<a href="https://github.com/hugo-fixit/FixIt" target="_blank" rel="external" title="FixIt %v">{themeLogo}FixIt</a>` (.Scratch.Get "version") -}}
|
||||
{{- $theme := printf `<a href="https://github.com/hugo-fixit/FixIt" target="_blank" rel="external" title="FixIt %v">{themeLogo}FixIt</a>` (hugo.Store.Get "version") -}}
|
||||
{{- if $footerConfig.powered.hugoLogo -}}
|
||||
{{- $hugoLogo := printf `<img class="hugo-icon" src="%v" alt="Hugo logo" /> ` (resources.Get "images/hugo.svg" | minify).RelPermalink -}}
|
||||
{{- $hugo = replace $hugo "{hugoLogo}" $hugoLogo -}}
|
||||
@@ -42,7 +42,7 @@
|
||||
{{- /* Author */ -}}
|
||||
{{- if ne $footerConfig.author false -}}
|
||||
<span class="author" itemprop="copyrightHolder">
|
||||
{{ partial "plugin/link.html" (dict "Destination" ($.Site.Params.author.link | default (.Scratch.Get "homeRelPermalink")) "Content" .Site.Params.author.name) -}}
|
||||
{{ partial "plugin/link.html" (dict "Destination" ($.Site.Params.author.link | default (.Site.Store.Get "homeRelPermalink")) "Content" .Site.Params.author.name) -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- $siteTime := .Scratch.Get "siteTime" -}}
|
||||
{{- $siteTime := .Site.Store.Get "siteTime" -}}
|
||||
{{- if $siteTime.enable -}}
|
||||
<div class="footer-line statistics{{ with $footerConfig.order.statistics }} order-{{ . }}{{ end }}">
|
||||
{{- if $siteTime.enable | and $siteTime.value -}}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{{- /* ID */ -}}
|
||||
{{- $noop := .Page.WordCount -}}
|
||||
{{- $id := "" -}}
|
||||
{{- with .Id -}}
|
||||
{{- /* If an ID is specified, then just use it.*/ -}}
|
||||
{{- $id = printf "%v" . -}}
|
||||
{{- else -}}
|
||||
{{- $count := ($.Scratch.Get "this").count | default 1 -}}
|
||||
{{- $count := ($.Page.Store.Get "this").count | default 1 -}}
|
||||
{{- $id = printf "id-%d" $count -}}
|
||||
{{- $count | add 1 | $.Scratch.SetInMap "this" "count" -}}
|
||||
{{- $count | add 1 | $.Page.Store.SetInMap "this" "count" -}}
|
||||
{{- end -}}
|
||||
{{- return $id -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $cdn := .Site.Store.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
|
||||
{{- $title := printf "%s %s %s" .Title .Site.Params.titleDelimiter .Site.Title -}}
|
||||
{{- if .IsHome -}}
|
||||
{{- $title = site.Title -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
|
||||
|
||||
{{- /* Check theme isDark before body rendering */ -}}
|
||||
{{- $options := dict "targetPath" "js/head/color-scheme.min.js" "minify" hugo.IsProduction -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- $buildDrafts := .Site.BuildDrafts -}}
|
||||
{{- $homeRelPermalink := .Scratch.Get "homeRelPermalink" -}}
|
||||
{{- $homeRelPermalink := .Site.Store.Get "homeRelPermalink" -}}
|
||||
|
||||
{{- /* Desktop header */ -}}
|
||||
<header class="desktop animate__faster" id="header-desktop">
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
{{- $social = dict "Id" $value | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- if $social.Icon.Simpleicons -}}
|
||||
{{- $prefix := ($.Scratch.Get "cdn" | default dict).simpleIconsPrefix -}}
|
||||
{{- $prefix := ($.Site.Store.Get "cdn" | default dict).simpleIconsPrefix -}}
|
||||
{{- $social = dict "Prefix" $prefix | dict "Icon" | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- $socialArr = $socialArr | append $social -}}
|
||||
|
||||
@@ -2,26 +2,14 @@
|
||||
{{- $warns := slice -}}
|
||||
{{- $errors := slice -}}
|
||||
|
||||
{{- with .Site.Params.gitRepo | or .Site.Params.page.edit -}}
|
||||
{{- $warns = $warns | append "The parameter `params.gitRepo` and `params.page.edit` is deprecated since v0.3.0, use `params.gitInfo` instead." -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Site.Params.customFilePath -}}
|
||||
{{- $warns = $warns | append "The parameter `params.customFilePath` is deprecated since v0.3.7, use `layouts/_partials/custom.html` instead." -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Site.Params.footer.custom -}}
|
||||
{{- $warns = $warns | append "The parameter `params.footer.custom` is deprecated since v0.3.7, use `layouts/_partials/custom.html` instead." -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Site.Params.ibruce -}}
|
||||
{{- $warns = $warns | append "The parameter `params.ibruce` is deprecated since v0.3.9, use `params.busuanzi` instead." -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if len $warns -}}
|
||||
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $warns "\n - ") -}}
|
||||
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (hugo.Store.Get "version") (delimit $warns "\n - ") -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if len $errors -}}
|
||||
{{- errorf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $errors "\n - ") -}}
|
||||
{{- errorf "Deprecated parameter detection until %v\n - %v\n\n" (hugo.Store.Get "version") (delimit $errors "\n - ") -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{{- /* FixIt theme environment detection */ -}}
|
||||
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if hugo.IsProduction -}}
|
||||
@@ -12,21 +11,21 @@
|
||||
{{- $cdn = printf "%v%v" $prefix $value | dict $key | merge $cdn -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "cdn" $cdn -}}
|
||||
{{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- .Scratch.Set "analytics" .Site.Params.analytics -}}
|
||||
{{- .Scratch.Set "comment" $params.comment -}}
|
||||
{{- .Site.Store.Set "cdn" $cdn -}}
|
||||
{{- .Site.Store.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- .Site.Store.Set "analytics" .Site.Params.analytics -}}
|
||||
{{- .Store.Set "comment" $params.comment -}}
|
||||
{{- if eq .Params.comment true -}}
|
||||
{{- .Scratch.Set "comment" .Site.Params.page.comment -}}
|
||||
{{- .Store.Set "comment" .Site.Params.page.comment -}}
|
||||
{{- else if eq .Params.comment false -}}
|
||||
{{- .Scratch.Set "comment" (dict "enable" false) -}}
|
||||
{{- .Store.Set "comment" (dict "enable" false) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Scratch.Set "devOpts" .Site.Params.dev -}}
|
||||
{{- .Site.Store.Set "devOpts" .Site.Params.dev -}}
|
||||
{{- if ne .Site.Params.dev.enable true -}}
|
||||
{{- .Scratch.Set "devOpts" dict -}}
|
||||
{{- .Site.Store.Set "devOpts" dict -}}
|
||||
{{- end -}}
|
||||
{{- if eq .Site .Sites.Default -}}
|
||||
{{- warnf "FixIt %v\n%v\n\n" (.Scratch.Get "version") (T "init.devEnvWarn") -}}
|
||||
{{- warnf "FixIt %v\n%v\n\n" (hugo.Store.Get "version") (T "init.devEnvWarn") -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{{- $version := .Scratch.Get "version" -}}
|
||||
{{- $version := hugo.Store.Get "version" -}}
|
||||
{{- $latest := $version -}}
|
||||
{{- $devOpts := .Scratch.Get "devOpts" -}}
|
||||
{{- $devOpts := .Site.Store.Get "devOpts" -}}
|
||||
|
||||
{{- /* Check for updates */ -}}
|
||||
{{- if $devOpts.c4u -}}
|
||||
{{- $url := "https://api.github.com/repos/hugo-fixit/FixIt/releases/latest" -}}
|
||||
{{- $options := dict "headers" (.Scratch.Get "githubTokenHeader") -}}
|
||||
{{- $options := dict "headers" (hugo.Store.Get "githubTokenHeader") -}}
|
||||
{{- $latest = (partial "function/get-remote-json" (dict "URL" $url "OPTIONS" $options )).tag_name -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -24,4 +24,4 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- .Scratch.Set "latest" $latest -}}
|
||||
{{- hugo.Store.Set "latest" $latest -}}
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
{{- $homeRelPermalink := .Site.Home.RelPermalink -}}
|
||||
{{- $homeRelPermalink = strings.TrimSuffix "archives/" $homeRelPermalink -}}
|
||||
{{- $homeRelPermalink = strings.TrimSuffix "offline/" $homeRelPermalink -}}
|
||||
{{- .Scratch.Set "homeRelPermalink" $homeRelPermalink -}}
|
||||
{{- .Site.Store.Set "homeRelPermalink" $homeRelPermalink -}}
|
||||
|
||||
{{- /* Set pages of main sections */ -}}
|
||||
{{- $pages := where .Site.RegularPages "Section" "in" .Site.MainSections -}}
|
||||
{{- $pages = $pages | union (where .Site.RegularPages "Type" "in" .Site.MainSections) -}}
|
||||
{{- .Scratch.Set "mainSectionPages" $pages -}}
|
||||
{{- .Site.Store.Set "mainSectionPages" $pages -}}
|
||||
|
||||
{{- /* Select the scope named `public_repo` to generate personal access token */ -}}
|
||||
{{- $header := dict "Authorization" "" -}}
|
||||
{{- with (getenv "HUGO_PARAMS_GHTOKEN") -}}
|
||||
{{- $header = dict "Authorization" (printf "token %v" .) -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "githubTokenHeader" $header -}}
|
||||
{{- hugo.Store.Set "githubTokenHeader" $header -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- .Scratch.Set "version" "v0.3.21-89f9373b" -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
{{- hugo.Store.Set "version" "v0.3.21-40345324" -}}
|
||||
{{- .Store.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
{{- partial "init/detection-version.html" . -}}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{{- if not (reflect.IsMap $toc) -}}
|
||||
{{- $toc = dict "enable" $toc | merge .Site.Params.page.toc -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "toc" $toc -}}
|
||||
{{- .Store.Set "toc" $toc -}}
|
||||
|
||||
{{- /* Reward data patch */ -}}
|
||||
{{- $reward := $params.reward -}}
|
||||
@@ -15,7 +15,7 @@
|
||||
{{- else if eq $reward false -}}
|
||||
{{- $reward = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "reward" $reward -}}
|
||||
{{- .Store.Set "reward" $reward -}}
|
||||
|
||||
{{- /* KaTeX data patch */ -}}
|
||||
{{- $math := $params.math -}}
|
||||
@@ -35,4 +35,4 @@
|
||||
{{- $siteTime = dict "enable" true "value" . | merge $siteTime -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "siteTime" $siteTime -}}
|
||||
{{- .Site.Store.Set "siteTime" $siteTime -}}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{{- if gt .Paginator.TotalPages 1 -}}
|
||||
<ul class="pagination">
|
||||
{{- .Scratch.Set "paginator.ellipsed" false -}}
|
||||
{{- .Site.Store.Set "paginator.ellipsed" false -}}
|
||||
{{- range $.Paginator.Pagers -}}
|
||||
{{- $right := sub .TotalPages .PageNumber -}}
|
||||
{{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
|
||||
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $.Paginator.PageNumber 3)) (lt .PageNumber (add $.Paginator.PageNumber 3))) -}}
|
||||
{{- if $showNumber -}}
|
||||
{{- $.Scratch.Set "paginator.ellipsed" false -}}
|
||||
{{- $.Scratch.Set "paginator.shouldEllipse" false -}}
|
||||
{{- $.Site.Store.Set "paginator.ellipsed" false -}}
|
||||
{{- $.Site.Store.Set "paginator.shouldEllipse" false -}}
|
||||
{{- else -}}
|
||||
{{- $.Scratch.Set "paginator.shouldEllipse" (not ($.Scratch.Get "paginator.ellipsed") ) -}}
|
||||
{{- $.Scratch.Set "paginator.ellipsed" true -}}
|
||||
{{- $.Site.Store.Set "paginator.shouldEllipse" (not ($.Site.Store.Get "paginator.ellipsed") ) -}}
|
||||
{{- $.Site.Store.Set "paginator.ellipsed" true -}}
|
||||
{{- end -}}
|
||||
{{- if $showNumber -}}
|
||||
<li class="page-item{{ if eq . $.Paginator }} active{{ end }}">
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="{{ .URL }}">{{ .PageNumber }}</a>
|
||||
</span>
|
||||
</li>
|
||||
{{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
|
||||
{{- else if ($.Site.Store.Get "paginator.shouldEllipse") -}}
|
||||
<li class="page-item">
|
||||
<span class="page-link" aria-hidden="true">…</span>
|
||||
</li>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $analytics := .Scratch.Get "analytics" | default dict -}}
|
||||
{{- $analytics := .Site.Store.Get "analytics" | default dict -}}
|
||||
|
||||
{{- if $analytics.enable -}}
|
||||
{{- /* Google Analytics */ -}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{- $compatibility := .Site.Params.compatibility | default dict -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $cdn := .Site.Store.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
|
||||
|
||||
{{- /* Polyfill.io */ -}}
|
||||
{{- if $compatibility.polyfill -}}
|
||||
@@ -11,12 +11,12 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with $features | uniq -}}
|
||||
{{- delimit . "%2C" | printf "https://cdnjs.cloudflare.com/polyfill/v3/polyfill.js?features=%v" | dict "Source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- delimit . "%2C" | printf "https://cdnjs.cloudflare.com/polyfill/v3/polyfill.js?features=%v" | dict "Source" | dict "Page" $ "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* object-fit-images */ -}}
|
||||
{{- if $compatibility.objectFit -}}
|
||||
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{{- $loading := resources.Get "images/loading.svg" | minify -}}
|
||||
{{- $id := "fixit-decryptor-input" -}}
|
||||
{{- if .IsPartial -}}
|
||||
{{- $id = dict "Scratch" page.Scratch | partial "function/id.html" -}}
|
||||
{{- $id = dict "Page" .Page | partial "function/id.html" -}}
|
||||
{{- end -}}
|
||||
<fixit-encryptor>
|
||||
<div class="fixit-decryptor-container">
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
{{- if $enable | and $key -}}
|
||||
{{- $configJS := "" -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
|
||||
{{- $sourceOpts := dict "Fingerprint" $fingerprint "Defer" true -}}
|
||||
|
||||
{{- /* PostSummary */ -}}
|
||||
{{- if $summaryEnable -}}
|
||||
{{- $postChatCSS := "https://ai.zhheo.com/static/public/postChatUser_summary.min.css" -}}
|
||||
{{- dict "Source" $postChatCSS "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $postChatCSS "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $p := "tianliGPT" -}}
|
||||
{{- $postSummaryConfig := printf "let %v_postSelector='#content';" $p -}}
|
||||
{{- with $summaryConfig.title -}}
|
||||
@@ -100,7 +100,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Insert config */ -}}
|
||||
{{- $configJS | dict "Content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $configJS | dict "Content" | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* Insert script */ -}}
|
||||
{{- $postChatJS := "" -}}
|
||||
@@ -112,5 +112,5 @@
|
||||
{{- $postChatJS = add $sourcePrefix (index $jsMap "summary") -}}
|
||||
{{- end -}}
|
||||
{{- $sourceOpts = dict "Source" $postChatJS | merge $sourceOpts -}}
|
||||
{{- $sourceOpts | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $sourceOpts | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -89,14 +89,14 @@
|
||||
{{- /* 013: Line */ -}}
|
||||
{{- if $share.Line -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Line" data-sharer="line" data-url="{{ .Permalink }}" data-title="{{ $title }}">
|
||||
{{- dict "Simpleicons" "line" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
{{- dict "Simpleicons" "line" "Prefix" (.Site.Store.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{ end -}}
|
||||
|
||||
{{- /* 014: Instapaper */ -}}
|
||||
{{- if $share.Instapaper -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Instapaper" data-sharer="instapaper" data-url="{{ .Permalink }}" data-title="{{ $title }}" data-description="{{ .Description }}">
|
||||
{{- dict "Simpleicons" "instapaper" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
{{- dict "Simpleicons" "instapaper" "Prefix" (.Site.Store.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{ end -}}
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
{{- /* 021: Myspace */ -}}
|
||||
{{- if $share.Myspace -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Myspace" data-sharer="myspace" data-url="{{ .Permalink }}" data-title="{{ $title }}" data-description="{{ .Description }}">
|
||||
{{- dict "Simpleicons" "myspace" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
{{- dict "Simpleicons" "myspace" "Prefix" (.Site.Store.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{ end -}}
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
{{- /* 023: 百度 */ -}}
|
||||
{{- if $share.Baidu -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ $title }}">
|
||||
{{- dict "Simpleicons" "baidu" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
{{- dict "Simpleicons" "baidu" "Prefix" (.Site.Store.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{ end -}}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{{- $dateformat := (index .Site.Params $scope).dateformat | default "01-02" -}}
|
||||
{{- $scopePages := .Pages -}}
|
||||
{{- if eq $scope "archives" -}}
|
||||
{{- $scopePages = .Scratch.Get "mainSectionPages" -}}
|
||||
{{- $scopePages = .Site.Store.Get "mainSectionPages" -}}
|
||||
{{- end -}}
|
||||
{{- $scopePages = where $scopePages.ByLastmod.Reverse "Section" "!=" "" -}}
|
||||
{{- $hiddenAdapters := .Param "hiddenAdapters" | default false -}}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{{- $this := .Scratch.Get "this" -}}
|
||||
{{- $noop := .Page.WordCount -}}
|
||||
{{- $this := .Page.Store.Get "this" -}}
|
||||
{{- $script := $this.script | default slice -}}
|
||||
{{- $script = $script | append (slice .Data) -}}
|
||||
{{- .Scratch.SetInMap "this" "script" $script -}}
|
||||
{{- .Page.Store.SetInMap "this" "script" $script -}}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{{- $this := .Scratch.Get "this" -}}
|
||||
|
||||
{{- $noop := .Page.WordCount -}}
|
||||
{{- $this := .Page.Store.Get "this" -}}
|
||||
{{- $style := $this.style | default slice -}}
|
||||
{{- $style = $style | append (slice .Data) -}}
|
||||
{{- .Scratch.SetInMap "this" "style" $style -}}
|
||||
{{- .Page.Store.SetInMap "this" "style" $style -}}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $comment := .Scratch.Get "comment" | default dict -}}
|
||||
{{- $cdn := .Site.Store.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
|
||||
{{- $comment := .Store.Get "comment" | default dict -}}
|
||||
{{- $commentConfig := dict "enable" false -}}
|
||||
|
||||
{{- if $comment.enable -}}
|
||||
{{- $commentConfig = dict "enable" true "expired" (.Scratch.Get "commentExpired" | default false) -}}
|
||||
{{- $commentConfig = dict "enable" true "expired" (.Store.Get "commentExpired" | default false) -}}
|
||||
<div id="comments">
|
||||
{{- /* Artalk Comment System */ -}}
|
||||
{{/*
|
||||
@@ -16,9 +16,9 @@
|
||||
{{- if $artalk.enable -}}
|
||||
<div id="artalk" class="comment"></div>
|
||||
{{- $source := $cdn.artalkCSS | default (add $artalk.server "/dist/Artalk.css") -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.artalkJS | default (add $artalk.server "/dist/Artalk.js") -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "el" "#artalk" "pageKey" .Permalink "pageTitle" .Title "pvEl" "artalk-visitor-count" "countEl" "artalk-comment-count" | dict "artalk" | merge $commentConfig -}}
|
||||
{{- if (eq $artalk.locale "") | and (eq $.Site.LanguageCode "en") -}}
|
||||
{{- $artalk = dict "locale" "en-US" | merge $artalk -}}
|
||||
@@ -93,7 +93,7 @@
|
||||
{{- if $disqus.enable -}}
|
||||
<div id="disqus_thread" class="comment"></div>
|
||||
{{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}}
|
||||
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript" rel="external nofollow noopener noreferrer">Disqus</a>.
|
||||
</noscript>
|
||||
@@ -104,9 +104,9 @@
|
||||
{{- if $gitalk.enable -}}
|
||||
<div id="gitalk" class="comment"></div>
|
||||
{{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk" rel="external nofollow noopener noreferrer">Gitalk</a>.
|
||||
@@ -118,9 +118,9 @@
|
||||
{{- if $valine.enable -}}
|
||||
<div id="valine" class="comment"></div>
|
||||
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
|
||||
{{- dict "Source" "lib/valine/valine.scss" "ToCSS" $options | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" "lib/valine/valine.scss" "ToCSS" $options | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "comment.valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}}
|
||||
{{- with $valine.avatar -}}
|
||||
{{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}}
|
||||
@@ -149,9 +149,9 @@
|
||||
{{- if $waline.enable -}}
|
||||
<div id="waline" class="comment"></div>
|
||||
{{- $source := $cdn.walineCSS | default "lib/waline/waline.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.walineJS | default "lib/waline/waline.umd.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "el" "#waline" "serverURL" $waline.serverURL "lang" .Lang "dark" "html[data-theme='dark']" | dict "waline" | merge $commentConfig -}}
|
||||
{{- $commentConfig = dict "copyright" true "imageUploader" false "highlighter" false "texRenderer" false "search" false | dict "waline" | merge $commentConfig -}}
|
||||
{{- with $waline.pageview -}}
|
||||
@@ -215,7 +215,7 @@
|
||||
data-numposts="{{ $facebook.numPosts }}"
|
||||
></div>
|
||||
{{- $source := printf "https://connect.facebook.net/%v/sdk.js#xfbml=1&version=v5.0&appId=%v&autoLogAppEvents=1" ($facebook.languageCode | default (T "comment.facebookLanguageCode")) $facebook.appId -}}
|
||||
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/" rel="external nofollow noopener noreferrer">Facebook</a>.
|
||||
</noscript>
|
||||
@@ -242,7 +242,7 @@
|
||||
{{- if $telegram.outlined -}}
|
||||
{{- $attr = printf `%v data-outlined="1"` $attr -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" "https://comments.app/js/widget.js?2" "Defer" true "Attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "https://comments.app/js/widget.js?2" "Defer" true "Attr" $attr | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://comments.app/" rel="external nofollow noopener noreferrer">Telegram Comments</a>.
|
||||
</noscript>
|
||||
@@ -252,7 +252,7 @@
|
||||
{{- $commento := $comment.commento | default dict -}}
|
||||
{{- if $commento.enable -}}
|
||||
<div id="commento" class="comment"></div>
|
||||
{{- dict "Source" "https://cdn.commento.io/js/commento.js" "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "https://cdn.commento.io/js/commento.js" "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://commento.io/" rel="external nofollow noopener noreferrer">Commento</a>.
|
||||
</noscript>
|
||||
@@ -278,7 +278,7 @@
|
||||
{{- if $twikoo.enable -}}
|
||||
<div id="twikoo"></div>
|
||||
{{- $source := $cdn.twikooJS | default "lib/twikoo/twikoo.all.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "el" "#twikoo" "envId" $twikoo.envId "lang" .Lang | dict "twikoo" | merge $commentConfig -}}
|
||||
{{- with $twikoo.region -}}
|
||||
{{- $commentConfig = dict "region" . | dict "twikoo" | merge $commentConfig -}}
|
||||
@@ -338,23 +338,23 @@
|
||||
{{- $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" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/plugins/thumbnail/lg-thumbnail.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/plugins/zoom/lg-zoom.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- /* KaTeX for Twikoo */ -}}
|
||||
{{- if $twikoo.enable | and $twikoo.katex -}}
|
||||
{{- $source := "https://cdn.jsdelivr.net/npm//katex@0.16.22/dist/katex.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := "https://cdn.jsdelivr.net/npm//katex@0.16.22/dist/katex.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := "https://cdn.jsdelivr.net/npm//katex@0.16.22/dist/contrib/auto-render.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- dict "comment" $commentConfig | dict "config" | merge (.Scratch.Get "this") | .Scratch.Set "this" -}}
|
||||
{{- dict "comment" $commentConfig | dict "config" | merge (.Store.Get "this") | .Store.Set "this" -}}
|
||||
|
||||
@@ -103,13 +103,13 @@
|
||||
{{- end -}}
|
||||
</section>
|
||||
<section>
|
||||
<span><a href="javascript:void(0);" onclick="window.history.back();">{{ T "single.back" }}</a></span> | <span><a href="{{ .Scratch.Get "homeRelPermalink" }}">{{ T "single.home" }}</a></span>
|
||||
<span><a href="javascript:void(0);" onclick="window.history.back();">{{ T "single.back" }}</a></span> | <span><a href="{{ .Site.Store.Get "homeRelPermalink" }}">{{ T "single.home" }}</a></span>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{{- $navigation := .Site.Params.navigation -}}
|
||||
<div class="post-nav">
|
||||
{{- $pages := .Scratch.Get "mainSectionPages" -}}
|
||||
{{- $pages := .Site.Store.Get "mainSectionPages" -}}
|
||||
{{- $prev := $pages.Prev . -}}
|
||||
{{- $next := $pages.Next . -}}
|
||||
{{- /* Show the post navigation in section pages */ -}}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if $params.related.enable | and ("aside" | in $params.related.position) | and (not $params.password) -}}
|
||||
{{- $posts := .Scratch.Get "mainSectionPages" -}}
|
||||
{{- $posts := .Site.Store.Get "mainSectionPages" -}}
|
||||
{{- if .Site.Params.page.hiddenFromRelated -}}
|
||||
{{- $posts = where $posts "Params.hiddenfromrelated" false -}}
|
||||
{{- else -}}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if $params.related.enable | and ("footer" | in $params.related.position) | and (not $params.password) -}}
|
||||
{{- $posts := .Scratch.Get "mainSectionPages" -}}
|
||||
{{- $posts := .Site.Store.Get "mainSectionPages" -}}
|
||||
{{- if .Site.Params.page.hiddenFromRelated -}}
|
||||
{{- $posts = where $posts "Params.hiddenfromrelated" false -}}
|
||||
{{- else -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $reward := .Scratch.Get "reward" -}}
|
||||
{{- $reward := .Store.Get "reward" -}}
|
||||
{{- $author := .Store.Get "author" -}}
|
||||
{{- $options := dict "Reward" $reward "Id" "fi-reward" "Author" $author.name -}}
|
||||
{{- partial "plugin/reward.html" $options -}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="widgets">
|
||||
{{- $backToTop := .Site.Params.backToTop -}}
|
||||
{{- $comment := .Scratch.Get "comment" -}}
|
||||
{{- $comment := .Store.Get "comment" -}}
|
||||
{{- if $backToTop.enable | or $comment.enable -}}
|
||||
<div class="fixed-buttons animate__faster d-none">
|
||||
{{- /* back to top button */ -}}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{{- /* Content */ -}}
|
||||
{{- $content := .Inner | .Page.RenderString -}}
|
||||
{{- /* Content Encryption */ -}}
|
||||
{{- dict "Content" $content "Password" $password "Message" $message "IsPartial" true | partial "plugin/fixit-encryptor.html" -}}
|
||||
{{- dict "Content" $content "Password" $password "Message" $message "IsPartial" true "Page" .Page | partial "plugin/fixit-encryptor.html" -}}
|
||||
{{- else -}}
|
||||
{{- .Inner -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $id := dict "Page" .Page | partial "function/id.html" -}}
|
||||
{{- $wechatpay := (.Get "wechatpay") | default (.Get 0) -}}
|
||||
{{- $alipay := (.Get "alipay") | default (.Get 1) -}}
|
||||
{{- $paypal := (.Get "paypal") | default (.Get 2) -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- $content := .Inner | .Page.RenderString -}}
|
||||
{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $id := dict "Page" .Page | partial "function/id.html" -}}
|
||||
{{- $tag := .Get 1 | default "div" -}}
|
||||
{{- printf `<%v id="%v">%v</%v>` $tag $id $content $tag | safeHTML -}}
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.LanguageCode }}">
|
||||
<head>
|
||||
{{ if .IsHome | and (ne .Site.Params.disableThemeInject true) }}
|
||||
<meta name="theme" content='FixIt {{ .Scratch.Get "version" }}'>
|
||||
<meta name="theme" content='FixIt {{ hugo.Store.Get "version" }}'>
|
||||
{{ end }}
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="wrapper" data-page-style="{{ (partial `function/params.html`).pageStyle | default `normal` }}">
|
||||
{{- partial "header.html" . -}}
|
||||
{{- partial "breadcrumb.html" . -}}
|
||||
{{- $toc := .Scratch.Get "toc" -}}
|
||||
{{- $toc := .Store.Get "toc" -}}
|
||||
<main class="container{{ if (eq $toc.enable true) | and (eq $toc.position `left`) }} container-reverse{{ end }}">
|
||||
{{- block "content" . }}{{ end -}}
|
||||
</main>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- /* All Posts */ -}}
|
||||
{{- $pages := .Scratch.Get "mainSectionPages" -}}
|
||||
{{- $pages := .Site.Store.Get "mainSectionPages" -}}
|
||||
|
||||
<div class="page archive">
|
||||
<div class="header">
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
{{- /* Posts */ -}}
|
||||
{{- if ne $posts.enable false | and .Site.RegularPages -}}
|
||||
{{- /* Paginate */ -}}
|
||||
{{- $pages := .Scratch.Get "mainSectionPages" -}}
|
||||
{{- $pages := .Site.Store.Get "mainSectionPages" -}}
|
||||
{{- if .Site.Params.page.hiddenFromHomePage -}}
|
||||
{{- $pages = where $pages "Params.hiddenfromhomepage" false -}}
|
||||
{{- else -}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> {{ .Site.Params.description }}
|
||||
|
||||
{{ $pages := .Scratch.Get "mainSectionPages" -}}
|
||||
{{ $pages := .Site.Store.Get "mainSectionPages" -}}
|
||||
{{- $pages = where $pages "Draft" "eq" false -}}
|
||||
{{- T "section.archiveCounter" (len $pages) }} by [{{ .Site.Params.author.name }}]({{ .Site.Params.author.link }}).
|
||||
{{ range $pages.GroupByPublishDate "2006" }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $options := dict "Site" .Site "Config" .Site.Params.feed "OutputFormats" .OutputFormats -}}
|
||||
{{- $options = dict "Permalink" .Permalink "Version" (.Scratch.Get "version") | merge $options -}}
|
||||
{{- $options = dict "Title" .Site.Title "Pages" (.Scratch.Get "mainSectionPages") | merge $options -}}
|
||||
{{- $options = dict "Permalink" .Permalink | merge $options -}}
|
||||
{{- $options = dict "Title" .Site.Title "Pages" (.Site.Store.Get "mainSectionPages") | merge $options -}}
|
||||
{{- partial "feed/rss.html" $options -}}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
|
||||
{{- /* Content Encryption */ -}}
|
||||
{{- dict "Content" $content "Password" $params.password "Message" $params.message | partial "plugin/fixit-encryptor.html" -}}
|
||||
{{- dict "Content" $content "Password" $params.password "Message" $params.message "Page" . | partial "plugin/fixit-encryptor.html" -}}
|
||||
|
||||
{{- /* Comment */ -}}
|
||||
{{- partial "single/comment.html" . -}}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{{- define "content" -}}
|
||||
{{- $title := cond (.Param "capitalizeTitles") (title .Title) .Title -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $toc := .Scratch.Get "toc" -}}
|
||||
{{- $toc := .Store.Get "toc" -}}
|
||||
{{- $tableOfContents := .Fragments.ToHTML ($toc.startlevel | int) ($toc.endlevel | int) ($toc.ordered | default false) -}}
|
||||
{{- $showToc := $toc.enable | and (ne $tableOfContents `<nav id="TableOfContents"></nav>`) -}}
|
||||
|
||||
@@ -85,9 +85,9 @@
|
||||
$expirationReminder.enable
|
||||
| and (gt (div (sub now.Unix .Lastmod.Unix) 86400) ($expirationReminder.warning | default 180))
|
||||
| and $expirationReminder.closeComment -}}
|
||||
{{- .Scratch.Set "commentExpired" true -}}
|
||||
{{- .Store.Set "commentExpired" true -}}
|
||||
{{- end -}}
|
||||
{{- $comment := .Scratch.Get "comment" | default dict -}}
|
||||
{{- $comment := .Store.Get "comment" | default dict -}}
|
||||
{{- $visitorIcon := dict "Class" "fa-regular fa-eye fa-fw me-1" | partial "plugin/icon.html" -}}
|
||||
{{- $commentIcon := dict "Class" "fa-regular fa-comments fa-fw me-1" | partial "plugin/icon.html" -}}
|
||||
{{- /* Visitor Count */ -}}
|
||||
@@ -187,13 +187,13 @@
|
||||
{{- partial "single/related.html" . -}}
|
||||
|
||||
{{- /* Reward before Footer */ -}}
|
||||
{{- $reward := .Scratch.Get "reward" -}}
|
||||
{{- $reward := .Store.Get "reward" -}}
|
||||
{{- if eq $reward.position "before" -}}
|
||||
{{- partial "single/reward.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Content Encryption */ -}}
|
||||
{{- dict "Content" $content "Password" $params.password "Message" $params.message | partial "plugin/fixit-encryptor.html" -}}
|
||||
{{- dict "Content" $content "Password" $params.password "Message" $params.message "Page" . | partial "plugin/fixit-encryptor.html" -}}
|
||||
|
||||
{{- /* Collection Navigation */ -}}
|
||||
{{- partial "single/collection-nav.html" . -}}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
{{- end -}}
|
||||
{{- $config := (.Params.feed | default dict) | merge .Site.Params.section.feed | merge .Site.Params.feed -}}
|
||||
{{- $options := dict "Site" .Site "Config" $config "OutputFormats" .OutputFormats -}}
|
||||
{{- $options = dict "Permalink" .Permalink "Version" (.Scratch.Get "version") | merge $options -}}
|
||||
{{- $options = dict "Permalink" .Permalink | merge $options -}}
|
||||
{{- $options = dict "Title" $title "Pages" .Pages | merge $options -}}
|
||||
{{- partial "feed/rss.html" $options -}}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
{{- end -}}
|
||||
{{- $config := (.Params.feed | default dict) | merge .Site.Params.list.feed | merge .Site.Params.feed -}}
|
||||
{{- $options := dict "Site" .Site "Config" $config "OutputFormats" .OutputFormats -}}
|
||||
{{- $options = dict "Permalink" .Permalink "Version" (.Scratch.Get "version") | merge $options -}}
|
||||
{{- $options = dict "Permalink" .Permalink | merge $options -}}
|
||||
{{- $options = dict "Title" $title "Pages" .Pages | merge $options -}}
|
||||
{{- partial "feed/rss.html" $options -}}
|
||||
|
||||
Reference in New Issue
Block a user