From b03390d237427a2b9cfee55949cb1da62f1a6856 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Sat, 29 Oct 2022 17:14:19 +0200 Subject: Revert "Merge branch 'canary' into master" (#712) Revert "Merge branch 'canary' into master (#711)" This reverts commit 8a597a5c9c861d2bce22a5e06c7667cd9c8e263a. --- layouts/_default/_markup/render-codeblock.html | 20 ----- layouts/_default/_markup/render-image.html | 2 +- layouts/_default/archives.html | 6 +- layouts/_default/list.html | 2 +- layouts/_default/rss.xml | 1 + layouts/index.html | 5 +- layouts/page/search.json | 7 +- layouts/partials/article-list/compact.html | 2 +- layouts/partials/article/components/header.html | 2 +- .../partials/article/components/photoswipe.html | 88 +++++++++++++++++----- .../article/components/related-content.html | 2 +- layouts/partials/data/title.html | 7 +- layouts/partials/footer/components/script.html | 2 + layouts/partials/footer/footer.html | 2 +- layouts/partials/head/colorScheme.html | 4 +- layouts/partials/head/head.html | 7 +- .../partials/head/opengraph/provider/twitter.html | 2 +- layouts/partials/sidebar/left.html | 4 +- layouts/partials/widget/archives.html | 4 +- 19 files changed, 104 insertions(+), 65 deletions(-) delete mode 100644 layouts/_default/_markup/render-codeblock.html (limited to 'layouts') diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html deleted file mode 100644 index 21c5100..0000000 --- a/layouts/_default/_markup/render-codeblock.html +++ /dev/null @@ -1,20 +0,0 @@ -{{- $class := .Attributes.class | default "" -}} -{{- $lang := .Attributes.lang | default .Type -}} -
-
- {{ $lang }} - -
- - {{- if transform.CanHighlight $lang -}} -
{{- highlight .Inner $lang -}}
- {{- else -}} -
{{- .Inner -}}
- {{- end -}} -
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 5577736..0ed5584 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -17,7 +17,7 @@ {{- $Height = $image.Height -}} {{- $galleryImage = true -}} - {{- if .Page.Site.Params.imageProcessing.content.enabled -}} + {{- if (default true .Page.Site.Params.imageProcessing.content.enabled) -}} {{- $small := $image.Resize `480x` -}} {{- $big := $image.Resize `1024x` -}} {{- $Srcset = printf `%s 480w, %s 1024w` $small.RelPermalink $big.RelPermalink -}} diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html index 9df633e..5d5243c 100644 --- a/layouts/_default/archives.html +++ b/layouts/_default/archives.html @@ -16,8 +16,10 @@ {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} - - {{ range $pages.GroupByDate "2006" }} + {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} + {{ $filtered := ($pages | intersect $notHidden) }} + + {{ range $filtered.GroupByDate "2006" }} {{ $id := lower (replace .Key " " "-") }}

{{ .Key }}

diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 4e1e0b5..9bc618d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -25,7 +25,7 @@ {{- $Width := $image.resource.Width -}} {{- $Height := $image.resource.Height -}} - {{- if .Page.Site.Params.imageProcessing.cover.enabled -}} + {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} {{- $thumbnail := $image.resource.Fill "120x120" -}} {{- $Permalink = $thumbnail.RelPermalink -}} {{- $Width = $thumbnail.Width -}} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 0d3170e..e9f3f1a 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -6,6 +6,7 @@ {{- else -}} {{- $pages = $pctx.Pages -}} {{- end -}} +{{- $pages := where $pages "Params.hidden" "!=" true -}} {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} diff --git a/layouts/index.html b/layouts/index.html index 5c1eaa5..0cd0b88 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,9 @@ {{ define "main" }} {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} - {{ $pag := .Paginate ($pages) }} + {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} + {{ $filtered := ($pages | intersect $notHidden) }} + {{ $pag := .Paginate ($filtered) }} +
{{ range $index, $element := $pag.Pages }} {{ partial "article-list/default" . }} diff --git a/layouts/page/search.json b/layouts/page/search.json index a0f5184..5d4e627 100644 --- a/layouts/page/search.json +++ b/layouts/page/search.json @@ -1,13 +1,16 @@ {{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}} +{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}} +{{- $filtered := ($pages | intersect $notHidden) -}} + {{- $result := slice -}} -{{- range $pages -}} +{{- range $filtered -}} {{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}} {{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}} {{- if $image.exists -}} {{- $imagePermalink := "" -}} - {{- if and $image.resource .Page.Site.Params.imageProcessing.cover.enabled -}} + {{- if and $image.resource (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} {{- $thumbnail := $image.resource.Fill "120x120" -}} {{- $imagePermalink = (absURL $thumbnail.Permalink) -}} {{- else -}} diff --git a/layouts/partials/article-list/compact.html b/layouts/partials/article-list/compact.html index edd58a0..376512a 100644 --- a/layouts/partials/article-list/compact.html +++ b/layouts/partials/article-list/compact.html @@ -19,7 +19,7 @@ {{- $Width := $image.resource.Width -}} {{- $Height := $image.resource.Height -}} - {{- if .Page.Site.Params.imageProcessing.cover.enabled -}} + {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} {{- $thumbnail := $image.resource.Fill "120x120" -}} {{- $Permalink = $thumbnail.RelPermalink -}} {{- $Width = $thumbnail.Width -}} diff --git a/layouts/partials/article/components/header.html b/layouts/partials/article/components/header.html index 78b41bd..7582ec2 100644 --- a/layouts/partials/article/components/header.html +++ b/layouts/partials/article/components/header.html @@ -9,7 +9,7 @@ {{- $Height := $image.resource.Height -}} {{- $Srcset := "" -}} - {{- if .Page.Site.Params.imageProcessing.cover.enabled -}} + {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} {{- $thumbnail := $image.resource.Resize "800x" -}} {{- $thumbnailRetina := $image.resource.Resize "1600x" -}} {{- $Srcset = printf "%s 800w, %s 1600w" $thumbnail.RelPermalink $thumbnailRetina.RelPermalink -}} diff --git a/layouts/partials/article/components/photoswipe.html b/layouts/partials/article/components/photoswipe.html index 425825c..c33ff49 100644 --- a/layouts/partials/article/components/photoswipe.html +++ b/layouts/partials/article/components/photoswipe.html @@ -1,20 +1,68 @@ -{{- $opts := dict "minify" hugo.IsProduction "format" "esm" -}} -{{- $galleryScript := resources.Get "ts/gallery.ts" | js.Build $opts -}} - - - - \ No newline at end of file + + + +{{- partial "helper/external" (dict "Context" . "Namespace" "PhotoSwipe") -}} \ No newline at end of file diff --git a/layouts/partials/article/components/related-content.html b/layouts/partials/article/components/related-content.html index 822fc73..aba88e3 100644 --- a/layouts/partials/article/components/related-content.html +++ b/layouts/partials/article/components/related-content.html @@ -1,4 +1,4 @@ -{{ $related := .Site.RegularPages.Related . | first 5 }} +{{ $related := (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | first 5 }} {{ with $related }}