From d9576c8e47f0f98ce175fc57590d33d04babc7b6 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Fri, 6 Jun 2025 16:50:39 +0800 Subject: refactor: reuse title-image (logo.html) Former-commit-id: 83e93e66caf86656b37659ac5ee60d3e840d19dd --- config/_default/params.yaml | 2 -- layouts/cards/single.html | 8 +------- layouts/library/single.html | 8 +------- layouts/partials/components/logo.html | 10 ++++++++++ layouts/partials/components/post-page-header.html | 12 +++++------- layouts/partials/header.html | 7 +------ 6 files changed, 18 insertions(+), 29 deletions(-) create mode 100644 layouts/partials/components/logo.html diff --git a/config/_default/params.yaml b/config/_default/params.yaml index 5314fee8..7eb983ca 100644 --- a/config/_default/params.yaml +++ b/config/_default/params.yaml @@ -30,5 +30,3 @@ giscus: emitMetadata: 0 inputPosition: top theme: "https://www.geedea.pro/css/giscus_noborder.css" -images: - header: https://image.guhub.cn/uPic/2025/05/header.png diff --git a/layouts/cards/single.html b/layouts/cards/single.html index 846f985b..0b269bca 100644 --- a/layouts/cards/single.html +++ b/layouts/cards/single.html @@ -1,12 +1,6 @@ {{ define "main" }}
- - Logo - + {{ partial "components/logo" (dict "link" "cards") }} {{ partial "items/card" (dict "context" .) }} {{- /* 查询引用了这个卡片的文章 */ -}} diff --git a/layouts/library/single.html b/layouts/library/single.html index 861cee24..1f051da7 100644 --- a/layouts/library/single.html +++ b/layouts/library/single.html @@ -22,13 +22,7 @@

- - Logo - + {{ partial "components/logo" (dict "link" "library") }}
diff --git a/layouts/partials/components/logo.html b/layouts/partials/components/logo.html new file mode 100644 index 00000000..36040768 --- /dev/null +++ b/layouts/partials/components/logo.html @@ -0,0 +1,10 @@ +{{ $default := "https://image.guhub.cn/uPic/2025/05/header.png" }} +{{ $link := .link | default "" }} +{{ $src := .src | default $default }} + + + Logo + diff --git a/layouts/partials/components/post-page-header.html b/layouts/partials/components/post-page-header.html index 3c572b45..4363b74c 100644 --- a/layouts/partials/components/post-page-header.html +++ b/layouts/partials/components/post-page-header.html @@ -1,10 +1,8 @@
- - Logo - + {{ if eq .Section "fictions" }} + {{ partial "components/logo" (dict "src" "/img/potted-skeleton.svg" "link" "fictions") }} + {{ else }} + {{ partial "components/logo" }} + {{ end }}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 8213690a..214552d6 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,12 +1,7 @@