diff options
| author | Eltrac <hi@guhub.cn> | 2025-06-06 16:50:39 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-06-06 16:50:39 +0800 |
| commit | d9576c8e47f0f98ce175fc57590d33d04babc7b6 (patch) | |
| tree | bf49cb935e9dd0715fcea059d64e7ef5dc327811 /layouts/partials/components | |
| parent | e954f0d0560f36948fb123539629085f128f64e8 (diff) | |
refactor: reuse title-image (logo.html)
Former-commit-id: 83e93e66caf86656b37659ac5ee60d3e840d19dd
Diffstat (limited to 'layouts/partials/components')
| -rw-r--r-- | layouts/partials/components/logo.html | 10 | ||||
| -rw-r--r-- | layouts/partials/components/post-page-header.html | 12 |
2 files changed, 15 insertions, 7 deletions
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 }} + +<a href="{{ .Site.LanguagePrefix }}/{{ $link }}" + class="title-image-container"> + <img src="{{ $src }}" alt="Logo" + class="invert-if-dark title-image" + style="view-transition-name: title-image" /> +</a> 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 @@ <header id="post-page-header" class="{{ with .Params.banner }}with-banner{{ end }} {{ if eq .Section "fictions" }}fiction-page-header{{ end }}"> - <a href="{{ .Site.LanguagePrefix }}/{{ if eq .Section "fictions" }}fictions{{ end }}" - class="title-image-container"> - <img src="{{ if eq .Section "fictions" }}/img/potted-skeleton.svg{{ else }}{{ .Site.Params.images.header }}{{ end }}" alt="Logo" - class="invert-if-dark title-image" - style="view-transition-name: title-image" - /> - </a> + {{ if eq .Section "fictions" }} + {{ partial "components/logo" (dict "src" "/img/potted-skeleton.svg" "link" "fictions") }} + {{ else }} + {{ partial "components/logo" }} + {{ end }} </header> |
