From 96f94aaf3a0507aaf8cb17e5f7ff32708887bfb6 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Mon, 17 Nov 2025 19:31:04 +0800 Subject: [PATCH 01/13] chore(theme): Bump theme submodule to v2.92.0 --- themes/blowfish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/blowfish b/themes/blowfish index b90210b30..63a119744 160000 --- a/themes/blowfish +++ b/themes/blowfish @@ -1 +1 @@ -Subproject commit b90210b30ee9e9ad7b3ee099ef459f928c64a91a +Subproject commit 63a11974499f2255d19802469857908bdb213536 From 057d92fdc1b7899829e5688a1a3dc0103d123f44 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Mon, 17 Nov 2025 19:36:26 +0800 Subject: [PATCH 02/13] chore(hugo): Bump Hugo to v0.152.2 --- .github/workflows/cron-check-int-links.yml | 2 +- .github/workflows/cron-deploy-hugo-site.yml | 2 +- .github/workflows/deploy-production.yml | 2 +- .github/workflows/pr-article-details.yml | 2 +- .github/workflows/pr-build-preview.yml | 2 +- .gitlab/ci/build_hugo.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cron-check-int-links.yml b/.github/workflows/cron-check-int-links.yml index 0dc64eaa8..8f25ae1de 100644 --- a/.github/workflows/cron-check-int-links.yml +++ b/.github/workflows/cron-check-int-links.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Install Hugo CLI env: - HUGO_VERSION: 0.147.5 + HUGO_VERSION: 0.152.2 run: | wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ && sudo dpkg -i ${{ runner.temp }}/hugo.deb diff --git a/.github/workflows/cron-deploy-hugo-site.yml b/.github/workflows/cron-deploy-hugo-site.yml index 7dc293f1a..00e1d92ab 100644 --- a/.github/workflows/cron-deploy-hugo-site.yml +++ b/.github/workflows/cron-deploy-hugo-site.yml @@ -30,7 +30,7 @@ jobs: - name: Install Hugo CLI env: - HUGO_VERSION: 0.147.5 + HUGO_VERSION: 0.152.2 run: | wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ && sudo dpkg -i ${{ runner.temp }}/hugo.deb diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index d69be16bd..50a3c8ca7 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -31,7 +31,7 @@ jobs: - name: Install Hugo CLI env: - HUGO_VERSION: 0.147.5 + HUGO_VERSION: 0.152.2 run: | wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ && sudo dpkg -i ${{ runner.temp }}/hugo.deb diff --git a/.github/workflows/pr-article-details.yml b/.github/workflows/pr-article-details.yml index 05500bb03..8e3425d2c 100644 --- a/.github/workflows/pr-article-details.yml +++ b/.github/workflows/pr-article-details.yml @@ -10,7 +10,7 @@ on: env: TARGET_REPO_URL: "https://github.com/espressif/developer-portal.git" TARGET_BRANCH: "main" - HUGO_VERSION: 0.147.5 + HUGO_VERSION: 0.152.2 jobs: check-article-details: diff --git a/.github/workflows/pr-build-preview.yml b/.github/workflows/pr-build-preview.yml index 89132096f..2cb508981 100644 --- a/.github/workflows/pr-build-preview.yml +++ b/.github/workflows/pr-build-preview.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Install Hugo CLI env: - HUGO_VERSION: 0.147.5 + HUGO_VERSION: 0.152.2 run: | wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ && sudo dpkg -i ${{ runner.temp }}/hugo.deb diff --git a/.gitlab/ci/build_hugo.yml b/.gitlab/ci/build_hugo.yml index 5fce9d125..4de058f2c 100644 --- a/.gitlab/ci/build_hugo.yml +++ b/.gitlab/ci/build_hugo.yml @@ -1,6 +1,6 @@ build_hugo: stage: build_hugo - image: "hugomods/hugo:debian-base-0.147.5" + image: "hugomods/hugo:debian-base-0.152.2" tags: - build_docs rules: From 33fc115d5b82b2c48543b5ae22a72d23dd81d623 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Thu, 20 Nov 2025 18:06:20 +0800 Subject: [PATCH 03/13] Revert "fix: temporary update blowfish figure shortcode" This reverts commit 0a48d12d89046474bf64be243d118b01575f39e8. --- .../shortcodes/figure-default.html | 43 ---------------- layouts/shortcodes/figure.html | 51 ------------------- 2 files changed, 94 deletions(-) delete mode 100644 layouts/partials/hugo-embedded/shortcodes/figure-default.html delete mode 100644 layouts/shortcodes/figure.html diff --git a/layouts/partials/hugo-embedded/shortcodes/figure-default.html b/layouts/partials/hugo-embedded/shortcodes/figure-default.html deleted file mode 100644 index e74d30be1..000000000 --- a/layouts/partials/hugo-embedded/shortcodes/figure-default.html +++ /dev/null @@ -1,43 +0,0 @@ -{{/* - Copied from Hugo v0.146 - Source: https://github.com/gohugoio/hugo/blob/83cfdd78ca6469e6d7265323d9fad1448880e559/tpl/tplimpl/embedded/templates/_shortcodes/figure.html -*/}} - - - {{- if .Get "link" -}} - - {{- end -}} - - {{- $u := urls.Parse (.Get "src") -}} - {{- $src := $u.String -}} - {{- if not $u.IsAbs -}} - {{- with or (.Page.Resources.Get $u.Path) (resources.Get $u.Path) -}} - {{- $src = .RelPermalink -}} - {{- end -}} - {{- end -}} - - {{ with .Get - {{- if .Get "link" }}{{ end -}} - {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} -
- {{ with (.Get "title") -}} -

{{ . }}

- {{- end -}} - {{- if or (.Get "caption") (.Get "attr") -}}

- {{- .Get "caption" | markdownify -}} - {{- with .Get "attrlink" }} - - {{- end -}} - {{- .Get "attr" | markdownify -}} - {{- if .Get "attrlink" }}{{ end }}

- {{- end }} -
- {{- end }} - diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html deleted file mode 100644 index 0b429187b..000000000 --- a/layouts/shortcodes/figure.html +++ /dev/null @@ -1,51 +0,0 @@ -{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} -{{ if .Get "default" }} - {{ partial "hugo-embedded/shortcodes/figure-default.html" . }} -{{ else }} - {{- $url := urls.Parse (.Get "src") }} - {{- $altText := .Get "alt" }} - {{- $caption := .Get "caption" }} - {{- $href := .Get "href" }} - {{- $class := .Get "class" }} - {{- $target := .Get "target" | default "_blank" }} - {{- $nozoom := .Get "nozoom" | default false -}} - -
- {{- with $href }}{{ end -}} - {{- if findRE "^https?" $url.Scheme }} - {{ $altText }} - {{- else }} - {{- $resource := "" }} - {{- if $.Page.Resources.GetMatch ($url.String) }} - {{- $resource = $.Page.Resources.GetMatch ($url.String) }} - {{- else if resources.GetMatch ($url.String) }} - {{- $resource = resources.Get ($url.String) }} - {{- end }} - {{- with $resource }} - {{- if or $disableImageOptimization (eq .MediaType.SubType "svg")}} - {{ $altText }} - {{- else }} - {{ $altText }} - {{- end }} - {{- else }} - {{ $altText }} - {{- end }} - {{- end }} - {{ with $caption }}
{{ . | markdownify }}
{{ end }} - {{ if $href }}
{{ end }} -
-{{- end -}} From b3380f976866ff6bc3da5b8f379b0e481259899f Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Thu, 20 Nov 2025 18:13:20 +0800 Subject: [PATCH 04/13] fix(yaml-frontmatter): remove duplicate showAuthor fields --- content/workshops/iot-introduction-with-rainmaker/index.md | 1 - .../workshops/micropython-jupyter-notebooks-in-browser/_index.md | 1 - 2 files changed, 2 deletions(-) diff --git a/content/workshops/iot-introduction-with-rainmaker/index.md b/content/workshops/iot-introduction-with-rainmaker/index.md index 7982fbb90..7bd28406c 100644 --- a/content/workshops/iot-introduction-with-rainmaker/index.md +++ b/content/workshops/iot-introduction-with-rainmaker/index.md @@ -6,7 +6,6 @@ tags: ["Workshop", "RainMaker", "ESP-IDF"] authors: - "pedro-minatel" showTableOfContents: false -showAuthor: false --- Welcome to the IoT workshop with [ESP RainMaker](https://rainmaker.espressif.com/). The ESP RainMaker was designed to empower you to build, develop, and deploy customized AIoT solutions effortlessly. ESP RainMaker ensures you can achieve your goals with minimal coding and maximum security. diff --git a/content/workshops/micropython-jupyter-notebooks-in-browser/_index.md b/content/workshops/micropython-jupyter-notebooks-in-browser/_index.md index 6f38d41ef..f81b66992 100644 --- a/content/workshops/micropython-jupyter-notebooks-in-browser/_index.md +++ b/content/workshops/micropython-jupyter-notebooks-in-browser/_index.md @@ -8,7 +8,6 @@ tags: ["Workshop", "MicroPython", "Jupyter", "Browser"] authors: - "daniel-paul" showTableOfContents: false -showAuthor: false summary: "In this workshop, you will learn how to program Espressif SoCs directly in your browser using MicroPython and Jupyter notebooks. We will primarily be using ESP32-C3-DevKit-RUST-2 development board. In the process, we will cover LED control, wireless communication, sensors, and MQTT." --- From f28533b47100ebc87fd69355ce12d1c7effc74c2 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Thu, 20 Nov 2025 18:30:36 +0800 Subject: [PATCH 05/13] chore(layout): add upstream blowfish files for overriding --- layouts/_default/baseof.html | 120 ++--- layouts/_default/single.html | 253 +++++----- .../partials/article-link/card-related.html | 157 +++--- layouts/partials/article-link/card.html | 157 +++--- layouts/partials/footer.html | 108 +++-- layouts/partials/head.html | 304 +++++++----- layouts/partials/header/basic.html | 459 +++++++++++------- layouts/partials/hero/basic.html | 79 ++- 8 files changed, 937 insertions(+), 700 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 59d2da489..b09cfe90b 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,75 +1,55 @@ - - + - + data-default-appearance="{{ site.Params.defaultAppearance | default `light` }}" + data-auto-appearance="{{ site.Params.autoSwitchAppearance | default `true` }}"> {{- partial "head.html" . -}} - - - - -
- - - - {{ $layout := default "basic" .Site.Params.header.layout }} - {{ $exists := printf "partials/header/%s.html" $layout }} - {{ $call := printf "header/%s.html" $layout }} - {{ if templates.Exists $exists }} - {{ partial $call . }} - {{ else }} - {{ partial "header/basic.html" . }} - {{ end }} - -
-
- {{ block "main" . }}{{ end }} - {{ if and (.Site.Params.footer.showScrollToTop | default true) (gt .WordCount 1) }} - {{- partial "scroll-to-top.html" . -}} - {{ end }} -
- - {{- partial "footer.html" . -}} - - {{ if .Site.Params.enableSearch | default false }} - {{- partial "search.html" . -}} + {{- partialCached "init.html" . -}} + + {{ $bodyLayout := "flex flex-col h-screen m-auto leading-7 max-w-7xl px-6 sm:px-14 md:px-24 lg:px-32" }} + {{ $bodyColor := "text-lg bg-neutral text-neutral-900 dark:bg-neutral-800 dark:text-neutral" }} + {{ $bodyScrollbar := "scrollbar-thin scrollbar-track-neutral-200 scrollbar-thumb-neutral-400 dark:scrollbar-track-neutral-800 dark:scrollbar-thumb-neutral-600" }} + + + {{ $header := print "header/" site.Params.header.layout ".html" }} + {{ if templates.Exists ( printf "partials/%s" $header ) }} + {{ partial $header . }} + {{ else }} + {{ partial "header/basic.html" . }} + {{ end }} +
+
+ {{ block "main" . }}{{ end }} + {{ if and (site.Params.footer.showScrollToTop | default true) }} + {{- partial "scroll-to-top.html" . -}} {{ end }} -
- -
- - + + {{- partial "footer.html" . -}} + {{ if site.Params.enableSearch | default false }} + {{- partial "search.html" . -}} + {{ end }} +
+ {{ if site.Params.buymeacoffee.globalWidget | default false }} + + {{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 8bd44334e..25ee02b6b 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,146 +1,151 @@ {{ define "main" }} -{{ .Scratch.Set "scope" "single" }} - -
- {{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }} - {{ $heroStyle := .Params.heroStyle }} - {{ if not $heroStyle }}{{ $heroStyle = .Site.Params.article.heroStyle }}{{ end }} - {{ $heroStyle := print "hero/" $heroStyle ".html" }} - {{ if templates.Exists ( printf "partials/%s" $heroStyle ) }} - {{ partial $heroStyle . }} - {{ else }} - {{ partial "hero/basic.html" . }} - {{ end }} - {{ end }} - -
- {{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }} - {{ partial "breadcrumbs.html" . }} - {{ end }} -

- {{ .Title | emojify }} -

-
- {{ partial "article-meta/basic.html" (dict "context" . "scope" "single") }} -
- - {{ $authorsData := .Site.Data.authors }} - {{ $taxonomies := .Site.Taxonomies.authors }} - {{ $baseURL := .Site.BaseURL }} - {{ $taxonomyLink := 0 }} - {{ $showAuthor := 0 }} - - {{ if not (strings.HasSuffix $baseURL "/") }} - {{ $baseURL = delimit (slice $baseURL "/") "" }} + {{ .Scratch.Set "scope" "single" }} +
+ {{/* Hero */}} + {{ if .Params.showHero | default (site.Params.article.showHero | default false) }} + {{ $heroStyle := .Params.heroStyle }} + {{ if not $heroStyle }}{{ $heroStyle = site.Params.article.heroStyle }}{{ end }} + {{ $heroStyle := print "hero/" $heroStyle ".html" }} + {{ if templates.Exists ( printf "partials/%s" $heroStyle ) }} + {{ partial $heroStyle . }} + {{ else }} + {{ partial "hero/basic.html" . }} + {{ end }} {{ end }} - {{ if not (.Params.showAuthorBottom | default ( .Site.Params.article.showAuthorBottom | default false)) }} - - {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }} - {{ $showAuthor = 1 }} - {{ partial "author.html" . }} + {{/* Header */}} +
+ {{ if .Params.showBreadcrumbs | default (site.Params.article.showBreadcrumbs | default false) }} + {{ partial "breadcrumbs.html" . }} {{ end }} - - {{ range $author := .Page.Params.authors }} - {{ $authorData := index $authorsData $author }} - {{- if $authorData -}} - {{ range $taxonomyname, $taxonomy := $taxonomies }} - {{ if (eq $taxonomyname $author) }} - {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }} - {{ end }} - {{ end }} - - {{ $finalLink := $taxonomyLink }} - {{ $currentLang := $.Site.Language.Lang }} - {{ if eq $.Site.LanguagePrefix "" }} - {{ $finalLink = printf "%sauthors/%s/" $baseURL $author }} - {{ else }} - {{ $finalLink = printf "%s%s/authors/%s/" $baseURL $currentLang $author }} - {{ end }} - - {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $finalLink) }} - {{- end -}} +

+ {{ .Title | emojify }} +

+
+ {{ partial "article-meta/basic.html" (dict "context" . "scope" "single") }} +
+ {{ if not (.Params.showAuthorBottom | default (site.Params.article.showAuthorBottom | default false)) }} + {{ template "SingleAuthor" . }} {{ end }} - - {{ if or $taxonomyLink $showAuthor }} -
+
+ + {{/* Body */}} +
+ {{ $enableToc := site.Params.article.showTableOfContents | default false }} + {{ $enableToc = .Params.showTableOfContents | default $enableToc }} + {{ $showToc := and $enableToc (in .TableOfContents " +
+ {{ if $showToc }} + {{ partial "toc.html" . }} + {{ end }} +
+ {{ end }} - {{ end }} - -
- -
- - {{ if or (and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in - .TableOfContents " -
- - {{ if and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in - .TableOfContents " -
- {{ end }}
- - {{ if .Params.summary }} -
- {{ .Summary | emojify }} -
- {{ end }} - + {{ partial "series/series.html" . }}
- {{ .Content | emojify }} + {{ .Content }} + {{ $defaultReplyByEmail := site.Params.replyByEmail }} + {{ $replyByEmail := default $defaultReplyByEmail .Params.replyByEmail }} + {{ if $replyByEmail }} + + + Reply by Email + + + {{ end }}
- {{ partial "sharing-links.html" . }} - - {{ if (eq (.Site.Params.defaultAppearance | default "light") "light") }} - {{ partial "giscus_light" . }} - {{ else }} - {{ partial "giscus_dark" . }} + {{ if (.Params.showAuthorBottom | default (site.Params.article.showAuthorBottom | default false)) }} + {{ template "SingleAuthor" . }} {{ end }} - + {{ partial "series/series-closed.html" . }} + {{ partial "sharing-links.html" . }} {{ partial "related.html" . }}
- {{ with .File }} - + {{ $translations := .AllTranslations }} + {{ with .File }} + {{ $path := .Path }} + {{ range $translations }} + {{ $lang := print "." .Lang ".md" }} + {{ $path = replace $path $lang ".md" }} + {{ end }} + {{ $jsPage := resources.Get "js/page.js" }} + {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint (site.Params.fingerprintAlgorithm | default "sha512") }} + {{ end }} - {{ $jsPage := resources.Get "js/page.js" }} - {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} - -
-
- {{ partial "article-pagination.html" . }} + {{/* Footer */}} +
+ {{ partial "article-pagination.html" . }} + {{ if .Params.showComments | default (site.Params.article.showComments | default false) }} + {{ if templates.Exists "partials/comments.html" }} +
+
+
+ {{ partial "comments.html" . }} +
+
+ {{ else }} + {{ warnf "[BLOWFISH] Comments are enabled for %s but no comments partial exists." .File.Path }} + {{ end }} + {{ end }} +
+
+{{ end }} + +{{ define "SingleAuthor" }} + {{ $authorsData := site.Data.authors }} + {{ $taxonomies := site.Taxonomies.authors }} + {{ $baseURL := site.BaseURL }} + {{ $taxonomyLink := 0 }} + {{ $showAuthor := 0 }} + {{ $isAuthorBottom := (.Params.showAuthorBottom | default ( site.Params.article.showAuthorBottom | default false)) }} - {{ if .Params.showComments | default (.Site.Params.article.showComments | default false) }} - {{ if templates.Exists "partials/comments.html" }} -
-
-
- {{ partial "comments.html" . }} -
-
- {{ else }} - {{ warnf "[BLOWFISH] Comments are enabled for %s but no comments partial exists." .File.Path }} - {{ end }} - {{ end }} + {{ if not (strings.HasSuffix $baseURL "/") }} + {{ $baseURL = delimit (slice $baseURL "/") "" }} + {{ end }} - {{ if .Store.Get "hasMermaid" }} - - {{ end }} + {{ if .Params.showAuthor | default (site.Params.article.showAuthor | default true) }} + {{ $showAuthor = 1 }} + {{ partial "author.html" . }} + {{ end }} - - + {{ range $author := .Page.Params.authors }} + {{ $authorData := index $authorsData $author }} + {{- if $authorData -}} + {{ range $taxonomyname, $taxonomy := $taxonomies }} + {{ if (eq $taxonomyname $author) }} + {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }} + {{ end }} + {{ end }} + + {{ $finalLink := $taxonomyLink }} + {{ $currentLang := site.Language.Lang }} + {{ if eq site.LanguagePrefix "" }} + {{ $finalLink = printf "%sauthors/%s/" $baseURL $author }} + {{ else }} + {{ $finalLink = printf "%s%s/authors/%s/" $baseURL $currentLang $author }} + {{ end }} + {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $finalLink) }} + {{- end -}} + {{ end }} + + {{ if or $taxonomyLink $showAuthor }} +
+ {{ end }} {{ end }} diff --git a/layouts/partials/article-link/card-related.html b/layouts/partials/article-link/card-related.html index 9a366b9af..0e4fdfd72 100644 --- a/layouts/partials/article-link/card-related.html +++ b/layouts/partials/article-link/card-related.html @@ -1,82 +1,99 @@ -{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} -{{ with .Params.externalUrl }} - - {{ else }} - - {{ end }} -
- - {{- with $.Params.images -}} - {{- range first 6 . }} - {{ end -}} - {{- else -}} - {{- $images := $.Resources.ByType "image" -}} - {{- $featured := $images.GetMatch "*feature*" -}} - {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} - {{ if and .Params.featureimage (not $featured) }} - {{- $url:= .Params.featureimage -}} - {{ $featured = resources.GetRemote $url }} - {{ end }} +{{/* Used by + 1. layouts/partials/related.html (related articles in single page) +*/}} +{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }} - {{ if .Params.featureAsset }} - {{- $genericImage := .Params.featureAsset -}} - {{- if not $featured }}{{ $featured = resources.Get $genericImage }}{{ end -}} - {{ end }} - - {{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} - {{- with $featured -}} - {{ if $disableImageOptimization }} - {{ with . }} - - {{ end }} +{{ $page := .Page }} +{{ $featured := "" }} +{{ $featuredURL := "" }} +{{/* frontmatter */}} +{{ with $page }} + {{ with .Params.featureimage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ if site.Params.hotlinkFeatureImage }} + {{ $featuredURL = . }} {{ else }} - {{ with .Resize "600x" }} - - {{ end }} + {{ $featured = resources.GetRemote . }} {{ end }} - {{- else -}} - {{- with $.Site.Params.images }} - {{ end -}} - {{- end -}} - {{- end -}} + {{ else }} + {{ $featured = resources.Get . }} + {{ end }} + {{ end }} + {{/* page resources */}} + {{ if not (or $featured $featuredURL) }} + {{ $images := .Resources.ByType "image" }} + {{ range slice "*feature*" "*cover*" "*thumbnail*" }} + {{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }} + {{ end }} + {{ end }} + + {{/* fallback to default */}} + {{ if not (or $featured $featuredURL) }} + {{ $default := site.Store.Get "defaultFeaturedImage" }} + {{ if $default.url }} + {{ $featuredURL = $default.url }} + {{ else if $default.obj }} + {{ $featured = $default.obj }} + {{ end }} + {{ end }} - {{ if and .Draft .Site.Params.article.showDraftLabel }} - - {{ partial "badge.html" (i18n "article.draft" | emojify) }} - + {{/* generate image URL if not hotlink */}} + {{ if not $featuredURL }} + {{ with $featured }} + {{ $featuredURL = .RelPermalink }} + {{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }} + {{ $featuredURL = (.Resize "600x").RelPermalink }} {{ end }} + {{ end }} + {{ end }} +{{ end }} - +
+ diff --git a/layouts/partials/article-link/card.html b/layouts/partials/article-link/card.html index 1c16b2f5f..a3e94262b 100644 --- a/layouts/partials/article-link/card.html +++ b/layouts/partials/article-link/card.html @@ -1,83 +1,102 @@ -{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} -{{ with .Params.externalUrl }} - - {{ else }} - - {{ end }} -
+{{/* Used by + 1. list.html and term.html (when the cardView option is enabled) + 2. Recent articles template (when the cardView option is enabled) + 3. Shortcode list.html +*/}} +{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }} - {{- with $.Params.images -}} - {{- range first 6 . }} - {{ end -}} - {{- else -}} - {{- $images := $.Resources.ByType "image" -}} - {{- $featured := $images.GetMatch "*feature*" -}} - {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} - {{ if and .Params.featureimage (not $featured) }} - {{- $url:= .Params.featureimage -}} - {{ $featured = resources.GetRemote $url }} +{{ $page := .Page }} +{{ $featured := "" }} +{{ $featuredURL := "" }} +{{ if not .Params.hideFeatureImage }} + {{/* frontmatter */}} + {{ with $page }} + {{ with .Params.featureimage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ if site.Params.hotlinkFeatureImage }} + {{ $featuredURL = . }} + {{ else }} + {{ $featured = resources.GetRemote . }} + {{ end }} + {{ else }} + {{ $featured = resources.Get . }} {{ end }} - - {{ if .Params.featureAsset }} - {{- $genericImage := .Params.featureAsset -}} - {{- if not $featured }}{{ $featured = resources.Get $genericImage }}{{ end -}} {{ end }} - {{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} - {{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }} - {{- with $featured -}} - {{ if $disableImageOptimization }} - {{ with . }} -
- {{ end }} - {{ else }} - {{ with .Resize "600x" }} -
- {{ end }} + {{/* page resources */}} + {{ if not (or $featured $featuredURL) }} + {{ $images := .Resources.ByType "image" }} + {{ range slice "*feature*" "*cover*" "*thumbnail*" }} + {{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }} {{ end }} - {{- else -}} - {{- with $.Site.Params.images }} - {{ end -}} - {{- end -}} - {{- end -}} + {{ end }} + {{/* fallback to default */}} + {{ if not (or $featured $featuredURL) }} + {{ $default := site.Store.Get "defaultFeaturedImage" }} + {{ if $default.url }} + {{ $featuredURL = $default.url }} + {{ else if $default.obj }} + {{ $featured = $default.obj }} + {{ end }} + {{ end }} - {{ if and .Draft .Site.Params.article.showDraftLabel }} - - {{ partial "badge.html" (i18n "article.draft" | emojify) }} - + {{/* generate image URL if not hotlink */}} + {{ if not $featuredURL }} + {{ with $featured }} + {{ $featuredURL = .RelPermalink }} + {{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }} + {{ $featuredURL = (.Resize "600x").RelPermalink }} + {{ end }} {{ end }} + {{ end }} + {{ end }} +{{ end }} -
+
+ diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 8149a1a2e..752e86bdc 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -2,67 +2,81 @@ {{/* Footer menu */}} {{ if .Site.Params.footer.showMenu | default true }} {{ if .Site.Menus.footer }} - + {{ end }} + {{ $navClass := printf "flex flex-row pb-4 text-base font-medium text-neutral-500 dark:text-neutral-400 %s" (cond $onlyIcon "overflow-x-auto py-2" "") }} + {{ $ulClass := printf "flex list-none %s" (cond $onlyIcon "flex-row" "flex-col sm:flex-row") }} + {{ $liClass := printf "flex mb-1 text-end sm:mb-0 sm:me-7 sm:last:me-0 %s" (cond $onlyIcon "me-4" "") }} + {{ end }} {{ end }}
- {{/* Copyright */}} {{ if .Site.Params.footer.showCopyright | default true }} -

- {{- with replace .Site.Params.copyright "{ year }" now.Year }} - {{ . | emojify | markdownify }} - {{- else }} - © - {{ now.Format "2006" }} - {{ .Site.Params.Author.name | markdownify | emojify }} - {{- end }} -

+

+ {{- with replace .Site.Params.copyright "{ year }" now.Year }} + {{ . | markdownify }} + {{- else }} + © + {{ now.Format "2006" }} + {{ .Site.Params.Author.name | markdownify }} + {{- end }} +

{{ end }} {{/* Theme attribution */}} {{ if .Site.Params.footer.showThemeAttribution | default true }} -

- {{ $hugo := printf `Hugo` - }} - {{ $blowfish := printf `Blowfish` }} - {{ i18n "footer.powered_by" (dict "Hugo" $hugo "Theme" $blowfish) | safeHTML }} -

+

+ {{ $hugo := printf `Hugo` + }} + {{ $blowfish := printf `Blowfish` + }} + {{ i18n "footer.powered_by" (dict "Hugo" $hugo "Theme" $blowfish) | safeHTML }} +

{{ end }} -
- + {{ if not .Site.Params.disableImageZoom | default true }} + + {{ end }} {{ $jsProcess := resources.Get "js/process.js" }} - {{ $jsProcess = $jsProcess | resources.Minify | resources.Fingerprint "sha512" }} - + {{ $jsProcess = $jsProcess | resources.Minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} + {{/* Extend footer - eg. for extra scripts, etc. */}} {{ if templates.Exists "partials/extend-footer.html" }} - {{ partialCached "extend-footer.html" . }} + {{ partialCached "extend-footer.html" . }} {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index c81e43b80..0ddba8735 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,145 +1,216 @@ - + {{ with .Site.Language.Params.htmlCode | default .Site.LanguageCode }} - + {{ end }} - - + + + + {{/* Title */}} - {{ if .IsHome -}} - {{ .Site.Title | emojify }} - - {{- else -}} - {{ .Title | emojify }} · {{ .Site.Title | emojify }} - - {{- end }} + {{ if .IsHome }} + {{ .Site.Title | emojify }} + + {{ else }} + {{ .Title | emojify }} · {{ .Site.Title | emojify }} + + {{ end }} + {{/* Metadata */}} - {{ with (.Params.Summary | default .Params.Description) | default .Site.Params.description -}} - - {{- end }} - {{ with .Params.Tags | default .Site.Params.keywords -}} - - {{- end }} + {{ with (.Params.Summary | default .Params.Description) | default .Site.Params.description }} + + {{ end }} + {{ with .Params.Tags | default .Site.Params.keywords }} + + {{ end }} {{ with .Site.Params.robots }} - + {{ end }} {{ with .Params.robots }} - - {{ end }} - - {{ range .AlternativeOutputFormats -}} - {{ printf ` - ` .Rel .MediaType.Type .RelPermalink ($.Site.Title | emojify) | - safeHTML }} - {{ end -}} - {{/* Asset bundles */}} - {{ $assets := newScratch }} - {{ $cssScheme := resources.Get (printf "css/schemes/%s.css" (.Site.Params.colorScheme | default "blowfish")) }} - {{ if not $cssScheme }} - {{ $cssScheme = resources.Get "css/schemes/blowfish.css" }} - {{ end }} - {{ $assets.Add "css" (slice $cssScheme) }} - {{ $cssMain := resources.Get "css/compiled/main.css" }} - {{ $assets.Add "css" (slice $cssMain) }} - {{ $cssCustom := resources.Get "css/custom.css" }} - {{ if $cssCustom }} - {{ $assets.Add "css" (slice $cssCustom) }} - {{ end }} - {{ $bundleCSS := $assets.Get "css" | resources.Concat "css/main.bundle.css" | resources.Minify | resources.Fingerprint - "sha512" }} - {{ $cssCustom := resources.Get "css/custom.css" }} - - - {{ $jsAppearance := resources.Get "js/appearance.js" }} - {{ $jsAppearance = $jsAppearance | resources.ExecuteAsTemplate "js/appearance.js" . | resources.Minify | resources.Fingerprint "sha512" }} - - {{ if .Site.Params.enableSearch | default false }} - {{ $jsFuse := resources.Get "lib/fuse/fuse.min.js" }} - {{ $jsSearch := resources.Get "js/search.js" }} - {{ $assets.Add "js" (slice $jsFuse $jsSearch) }} + {{ end }} - {{ if .Site.Params.enableCodeCopy | default false }} - {{ $jsCode := resources.Get "js/code.js" }} - {{ $assets.Add "js" (slice $jsCode) }} + + {{ range .AlternativeOutputFormats }} + {{ printf ` + ` .Rel .MediaType.Type .RelPermalink ($.Site.Title | emojify) | + safeHTML + }} {{ end }} - {{ if .Site.Params.rtl | default false }} - {{ $jsRTL := resources.Get "js/rtl.js" }} - {{ $assets.Add "js" (slice $jsRTL) }} - {{ end }} - {{ $jsMobileMenu := resources.Get "js/mobilemenu.js" }} - {{ $assets.Add "js" (slice $jsMobileMenu) }} - {{ if $assets.Get "js" }} - {{ $bundleJS := $assets.Get "js" | resources.Concat "js/main.bundle.js" | resources.Minify | resources.Fingerprint - "sha512" }} - + + {{/* Me */}} + {{ with .Site.Params.Author.name }} + {{ end }} - {{ if not .Site.Params.disableImageZoom | default true }} - {{ $zoomJS := resources.Get "lib/zoom/zoom.min.js" | resources.Fingerprint "sha512" }} - + {{ with .Site.Params.Author.links }} + {{ range $links := . }} + {{ range $name, $url := $links }} + {{ if not (strings.HasPrefix $url "mailto:") }} + + {{ end }} + {{ end }} + {{ end }} {{ end }} - {{/* Icons */}} - {{ if templates.Exists "partials/favicons.html" }} - {{ partialCached "favicons.html" .Site }} - {{ else }} - - - - + + {{/* Social */}} + {{ template "_internal/opengraph.html" . }} + {{ template "_internal/twitter_cards.html" . }} + {{/* Use defaultSocialImage if feature image does not exist */}} + {{ $featureImage := "" }} + {{ $pageImages := .Resources.ByType "image" }} + {{ range slice "*featured*" "*cover*" "*thumbnail*" }} + {{ if not $featureImage }} + {{ $featureImage = $pageImages.GetMatch . }} + {{ end }} + {{ end }} + {{ if not $featureImage }} + {{ with .Site.Params.defaultSocialImage }} + {{ $socialImage := "" }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $socialImage = resources.GetRemote . }} + {{ else }} + {{ $socialImage = resources.Get . }} + {{ end }} + {{ with $socialImage }} + + + {{ end }} + {{ end }} {{ end }} + {{/* Site Verification */}} {{ with .Site.Params.verification.google }} - + {{ end }} {{ with .Site.Params.verification.bing }} - + {{ end }} {{ with .Site.Params.verification.pinterest }} - + {{ end }} {{ with .Site.Params.verification.yandex }} - + {{ end }} - {{/* Social */}} - {{ template "_internal/opengraph.html" . }} - {{ template "_internal/twitter_cards.html" . }} - {{/* Schema */}} - {{ partial "schema.html" . }} - {{/* Me */}} - {{ with .Site.Params.Author.name }} - {{ end }} - {{ with .Site.Params.Author.links }} - {{ range $links := . }} - {{ range $name, $url := $links }} - {{ end }} + {{ with .Site.Params.verification.fediverse }} + {{ end }} + + {{ $alg := .Site.Params.fingerprintAlgorithm | default "sha512" }} + + {{/* CSS */}} + {{ $cssResources := slice }} + {{ $schemeName := .Site.Params.colorScheme | default "blowfish" }} + {{ $cssScheme := resources.Get (printf "css/schemes/%s.css" $schemeName) | default (resources.Get "css/schemes/blowfish.css") }} + {{ $cssResources = $cssResources | append $cssScheme }} + {{ $cssResources = $cssResources | append (resources.Get "css/compiled/main.css") }} + {{ with resources.Get "css/custom.css" }} + {{ $cssResources = $cssResources | append . }} + {{ end }} + {{ if not .Site.Params.disableImageZoom | default true }} + {{ $cssResources = $cssResources | append (resources.Get "lib/zoom/style.css") }} + {{ end }} + {{ $bundleCSS := $cssResources | resources.Concat "css/main.bundle.css" | resources.Minify | resources.Fingerprint $alg }} + + + {{/* JS loaded immediately */}} + {{ $jsAppearance := resources.Get "js/appearance.js" | resources.ExecuteAsTemplate "js/appearance.js" . | resources.Minify | resources.Fingerprint $alg }} + + {{ $enableA11y := .Site.Params.enableA11y | default false }} + {{ if $enableA11y }} + {{ $jsA11y := resources.Get "js/a11y.js" | resources.Minify | resources.Fingerprint $alg }} + + {{ end }} + {{ $showZenMode := .Params.showZenMode | default (.Site.Params.article.showZenMode | default false) }} + {{ $shouldIncludeZenMode := or $enableA11y $showZenMode }} + {{ if and .IsPage $shouldIncludeZenMode }} + {{ $jsZenMode := resources.Get "js/zen-mode.js" | resources.Minify | resources.Fingerprint $alg }} + + {{ end }} + {{ if not .Site.Params.disableImageZoom | default true }} + {{ $zoomJS := resources.Get "lib/zoom/zoom.min.umd.js" | resources.Fingerprint $alg }} + + {{ end }} + + {{/* JS deferred */}} + {{ $jsResources := slice }} + {{ if site.Params.footer.showScrollToTop | default true }} + {{ $jsResources = $jsResources | append (resources.Get "js/scroll-to-top.js") }} + {{ end }} + {{ if .Site.Params.enableSearch | default false }} + {{ $jsResources = $jsResources | append (resources.Get "lib/fuse/fuse.min.js") | append (resources.Get "js/search.js") }} + {{ end }} + {{ if .Site.Params.enableCodeCopy | default false }} + {{ $jsResources = $jsResources | append (resources.Get "js/code.js") }} + {{ end }} + {{ if .Site.Params.rtl | default false }} + {{ $jsResources = $jsResources | append (resources.Get "js/rtl.js") }} + {{ end }} + {{ $jsResources = $jsResources | append (resources.Get "js/mobilemenu.js") }} + {{ $jsResources = $jsResources | append (resources.Get "js/button-likes.js") }} + {{ $jsResources = $jsResources | append (resources.Get "js/katex-render.js") }} + {{ if $jsResources }} + {{ $bundleJS := $jsResources | resources.Concat "js/main.bundle.js" | resources.Minify | resources.Fingerprint $alg }} + {{ end }} - {{/* Vendor */}} + + {{/* Conditional loaded resources */}} {{ partial "vendor.html" . }} - {{ partial "vendor_custom.html" . }} - {{ partial "learn_custom.html" . }} - {{ partial "dynamic_md_block.html" . }} + + {{/* Icons */}} + {{ if templates.Exists "partials/favicons.html" }} + {{ partialCached "favicons.html" .Site }} + {{ else }} + + + + + {{ end }} + + {{/* Schema */}} + {{ partial "schema.html" . }} + {{/* Analytics */}} - {{ partial "analytics/main.html" .Site }} + {{ if hugo.IsProduction }} + {{ partial "analytics/main.html" . }} + {{ end }} + {{/* Extend head - eg. for custom analytics scripts, etc. */}} {{ if templates.Exists "partials/extend-head.html" }} - {{ partialCached "extend-head.html" .Site }} + {{ partialCached "extend-head.html" .Site }} {{ end }} - + + {{/* Uncached extend head - Example: https://gohugo.io/methods/page/hasshortcode/ */}} + {{ if templates.Exists "partials/extend-head-uncached.html" }} + {{ partial "extend-head-uncached.html" . }} + {{ end }} + {{/* Firebase */}} {{ with $.Site.Params.firebase }} - {{ if isset $.Site.Params "firebase" }} - - - - + + + + + {{ end }} {{ end }} + + {{/* Advertisement */}} + {{ with .Site.Params.advertisement.adsense }} + + {{ end }} diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index 008c0ec03..b4fb3fe69 100644 --- a/layouts/partials/header/basic.html +++ b/layouts/partials/header/basic.html @@ -1,225 +1,308 @@ - +
+{{ end }} -
-
+{{ define "HeaderA11y" }} + {{- $prefix := .prefix | default "" -}} +
+ - {{ partial "translations.html" . }} + - {{ if .Site.Params.enableSearch | default false }} - - {{ end }} + +
+{{ end }} + +{{/* ========== Render HTML ========== */}} + {{ if .Site.Menus.subnavigation }} - {{ end }} {{ if .Site.Params.highlightCurrentMenuArea }} - -{{ end }} - -{{ $styles := resources.Get "css/styles.css" }} -{{ if $styles }} - + {{ end }} diff --git a/layouts/partials/hero/basic.html b/layouts/partials/hero/basic.html index 86ea6f2c6..15772034c 100644 --- a/layouts/partials/hero/basic.html +++ b/layouts/partials/hero/basic.html @@ -1,24 +1,63 @@ -{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} +{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }} -{{- $images := .Resources.ByType "image" -}} -{{- $featured := $images.GetMatch "*feature*" -}} -{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} -{{ if .Params.featureimage }} -{{- $url:= .Params.featureimage -}} -{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}} +{{ $useDefault := false }} +{{ $featured := "" }} +{{ $featuredURL := "" }} +{{ with .Params.featureimage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ if site.Params.hotlinkFeatureImage }} + {{ $featuredURL = . }} + {{ else }} + {{ $featured = resources.GetRemote . }} + {{ end }} + {{ else }} + {{ $featured = resources.Get . }} + {{ end }} {{ end }} -{{ if .Params.featureAsset }} - {{- $genericImage := .Params.featureAsset -}} - {{- if not $featured }}{{ $featured = resources.Get $genericImage }}{{ end -}} + +{{ if not (or $featured $featuredURL) }} + {{ $images := .Resources.ByType "image" }} + {{ range slice "*background*" "*feature*" "*cover*" "*thumbnail*" }} + {{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }} + {{ end }} {{ end }} -{{- with $featured -}} - {{ if $disableImageOptimization }} - {{ with . }} -
- {{ end }} - {{ else }} - {{ with .Resize "1200x" }} -
- {{ end }} + +{{ if not (or $featured $featuredURL) }} + {{ $default := site.Store.Get "defaultBackgroundImage" }} + {{ if $default.url }} + {{ $featuredURL = $default.url }} + {{ $useDefault = true }} + {{ else if $default.obj }} + {{ $featured = $default.obj }} + {{ $useDefault = true }} + {{ end }} +{{ end }} + +{{/* generate image URL if not hotlink */}} +{{ if not $featuredURL }} + {{ with $featured }} + {{ $featuredURL = .RelPermalink }} + {{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }} + {{ $size := site.Store.Get "backgroundImageWidth" }} + {{ $featuredURL = (.Resize $size).RelPermalink }} {{ end }} -{{- end -}} + {{ end }} +{{ end }} + +{{ with $featuredURL }} + {{ $style := "" }} + {{ $defaultPosition := cond $useDefault site.Params.imagePosition false }} + {{ with $.Params.imagePosition | default $defaultPosition }} + {{ $style = printf "object-position: %s;" . }} + {{ end }} +
+ {{ with $.Params.featureimagealt }}{{ . }}{{ else }}{{ with $.Title }}Featured image for {{ . }}{{ else }}Featured image{{ end }}{{ end }} +
+{{ end }} From 939cd45060e8be0e0f31061528377b7e9e005a7f Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Thu, 11 Dec 2025 17:40:37 +0800 Subject: [PATCH 06/13] chore(layout): remove layouts/partials/toc.html as it has no overrides --- layouts/partials/toc.html | 65 --------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 layouts/partials/toc.html diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html deleted file mode 100644 index 9789b3d8e..000000000 --- a/layouts/partials/toc.html +++ /dev/null @@ -1,65 +0,0 @@ - -
- - {{ i18n "article.table_of_contents" }} - -
- {{ .TableOfContents | emojify }} -
-
- -{{ if .Site.Params.smartTOC }} - -{{ end }} From ad0175247c5426c97ac842e21ef96d3143013d5d Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Thu, 20 Nov 2025 18:32:50 +0800 Subject: [PATCH 07/13] chore(layout): incorporate upstream changes to overridden blowfish files --- layouts/_default/baseof.html | 36 +++++- layouts/_default/single.html | 15 +++ .../partials/article-link/card-related.html | 6 + layouts/partials/article-link/card.html | 6 + layouts/partials/footer.html | 6 +- layouts/partials/giscus-auto.html | 12 ++ layouts/partials/head.html | 3 + layouts/partials/header/basic.html | 115 ++++++++++++------ layouts/partials/hero/basic.html | 6 + layouts/partials/mermaid-init.html | 11 ++ 10 files changed, 176 insertions(+), 40 deletions(-) create mode 100644 layouts/partials/giscus-auto.html create mode 100644 layouts/partials/mermaid-init.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index b09cfe90b..df6bc6355 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -27,7 +27,7 @@ {{ partial "header/basic.html" . }} {{ end }}
-
+
{{ block "main" . }}{{ end }} {{ if and (site.Params.footer.showScrollToTop | default true) }} {{- partial "scroll-to-top.html" . -}} @@ -38,7 +38,9 @@ {{- partial "search.html" . -}} {{ end }}
- + + {{/* Remove buymeacoffee widget */}} + + + + diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 25ee02b6b..3c66ce9d3 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -47,7 +47,15 @@

+ + {{ if .Params.summary }} +
+ {{ .Summary | emojify }} +
+ {{ end }} + {{ partial "series/series.html" . }} +
{{ .Content }} {{ $defaultReplyByEmail := site.Params.replyByEmail }} @@ -66,8 +74,12 @@

{{ if (.Params.showAuthorBottom | default (site.Params.article.showAuthorBottom | default false)) }} {{ template "SingleAuthor" . }} {{ end }} + {{ partial "series/series-closed.html" . }} {{ partial "sharing-links.html" . }} + + {{ partial "giscus-auto.html" . }} + {{ partial "related.html" . }}

@@ -104,6 +116,9 @@

{{ warnf "[BLOWFISH] Comments are enabled for %s but no comments partial exists." .File.Path }} {{ end }} {{ end }} + + {{ partial "mermaid-init.html" . }} + {{ end }} diff --git a/layouts/partials/article-link/card-related.html b/layouts/partials/article-link/card-related.html index 0e4fdfd72..7b1fda61b 100644 --- a/layouts/partials/article-link/card-related.html +++ b/layouts/partials/article-link/card-related.html @@ -20,6 +20,12 @@ {{ end }} {{ end }} + {{/* Allow adding feature images from the assets folder */}} + {{ if .Params.featureAsset }} + {{- $genericImage := .Params.featureAsset -}} + {{- if not $featured }}{{ $featured = resources.Get $genericImage }}{{ end -}} + {{ end }} + {{/* page resources */}} {{ if not (or $featured $featuredURL) }} {{ $images := .Resources.ByType "image" }} diff --git a/layouts/partials/article-link/card.html b/layouts/partials/article-link/card.html index a3e94262b..f26e21d49 100644 --- a/layouts/partials/article-link/card.html +++ b/layouts/partials/article-link/card.html @@ -23,6 +23,12 @@ {{ end }} {{ end }} + {{/* Allow adding feature images from the assets folder */}} + {{ if .Params.featureAsset }} + {{- $genericImage := .Params.featureAsset -}} + {{- if not $featured }}{{ $featured = resources.Get $genericImage }}{{ end -}} + {{ end }} + {{/* page resources */}} {{ if not (or $featured $featuredURL) }} {{ $images := .Resources.ByType "image" }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 752e86bdc..5695b1c79 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -25,7 +25,7 @@ {{ partial "icon.html" .Pre }} {{ end }} - {{ .Name | markdownify }} + {{ .Name | markdownify | emojify }} {{ end }} @@ -38,11 +38,11 @@ {{ if .Site.Params.footer.showCopyright | default true }}

{{- with replace .Site.Params.copyright "{ year }" now.Year }} - {{ . | markdownify }} + {{ . | markdownify | emojify }} {{- else }} © {{ now.Format "2006" }} - {{ .Site.Params.Author.name | markdownify }} + {{ .Site.Params.Author.name | markdownify | emojify }} {{- end }}

{{ end }} diff --git a/layouts/partials/giscus-auto.html b/layouts/partials/giscus-auto.html new file mode 100644 index 000000000..071bf9034 --- /dev/null +++ b/layouts/partials/giscus-auto.html @@ -0,0 +1,12 @@ +{{/* + Injects the correct Giscus component depending on the default appearance. + - If the site default theme is "light": loads giscus_light. + - Otherwise: loads giscus_dark. + This only switches on first render; user theme switching handled by Giscus itself. +*/}} + +{{ if (eq (.Site.Params.defaultAppearance | default "light") "light") }} + {{ partial "features/giscus_light" . }} +{{ else }} + {{ partial "features/giscus_dark" . }} +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 0ddba8735..eeebaeba2 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -171,6 +171,9 @@ {{/* Conditional loaded resources */}} {{ partial "vendor.html" . }} + {{ partial "vendor_custom.html" . }} + {{ partial "learn_custom.html" . }} + {{ partial "dynamic_md_block.html" . }} {{/* Icons */}} {{ if templates.Exists "partials/favicons.html" }} diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index b4fb3fe69..a593c14a4 100644 --- a/layouts/partials/header/basic.html +++ b/layouts/partials/header/basic.html @@ -3,6 +3,7 @@ {{ if .Site.Params.Logo }} {{ $logo := resources.Get .Site.Params.Logo }} {{ if $logo }} + {{ $scalingFactor := 0.125 }} @@ -49,7 +50,7 @@ {{ end }} {{ if .Site.Params.footer.showAppearanceSwitcher | default false }} -
+
{{ end }} -
{{ end }} {{ define "HeaderMobileNavigation" }} -
-
{{ end }} {{ define "HeaderA11y" }} @@ -200,7 +195,7 @@
{{ $toggles := slice }} {{ $shouldDisableBlur := or site.Params.homepage.layoutBackgroundBlur site.Params.article.layoutBackgroundBlur site.Params.list.layoutBackgroundBlur }} - {{ $shouldDisableBackgroundImage := or + {{ $shouldDisableBackgroundImage := or (eq site.Params.homepage.layout "background") (eq site.Params.article.heroStyle "background") (eq site.Params.list.heroStyle "background") @@ -252,27 +247,32 @@ {{/* ========== Render HTML ========== */}}