summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2025-12-17 19:49:33 +0800
committerBigCoke233 <hi@guhub.cn>2025-12-17 19:49:33 +0800
commit96d75f82475745d5b26ee05b005b0d48b42b7b48 (patch)
tree1d921e28c1c1a3c587f1326fedabad4f0b0e957c
parent6fdbcea7c1477ce57352f62d18edf9cdea40219f (diff)
fix: unexpectedly navigate back to CN site the context did not pass to logo
component, hence `.Site.LanguagePrefix` gives nothing.
-rw-r--r--config/_default/config.yaml2
-rw-r--r--layouts/_partials/components/logo.html3
-rw-r--r--layouts/_partials/header.html2
-rw-r--r--layouts/_partials/template/post-page.html2
-rw-r--r--layouts/blank.html2
-rw-r--r--layouts/cards/page.html1
-rw-r--r--layouts/fictions/page.html1
-rw-r--r--layouts/library/page.html3
8 files changed, 11 insertions, 5 deletions
diff --git a/config/_default/config.yaml b/config/_default/config.yaml
index d52641bf..34d7c8d4 100644
--- a/config/_default/config.yaml
+++ b/config/_default/config.yaml
@@ -2,7 +2,7 @@ baseURL: https://www.geedea.pro/
timeZone: Asia/Shanghai
hasCJKLanguage: true
defaultContentLanguage: zh
-defaultContentLanguageInSubdir: true
+defaultContentLanguageInSubdir: false
outputs:
home:
- HTML
diff --git a/layouts/_partials/components/logo.html b/layouts/_partials/components/logo.html
index 3a8cbf7a..a7c2d560 100644
--- a/layouts/_partials/components/logo.html
+++ b/layouts/_partials/components/logo.html
@@ -3,8 +3,9 @@
{{ $src := .src | default $default }}
{{ $class := .class | default "" }}
{{ $imageClass := .imageClass | default "" }}
+{{ $ctx := .ctx }}
-<a href="{{ .Site.LanguagePrefix }}/{{ $link }}"
+<a href="{{ $ctx.Site.LanguagePrefix }}/{{ $link }}"
class="title-image-container {{ $class }}">
<img src="{{ $src }}" alt="Logo"
class="dark:invert title-image {{ $imageClass }}"
diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html
index 75410879..d43c1d4f 100644
--- a/layouts/_partials/header.html
+++ b/layouts/_partials/header.html
@@ -2,7 +2,7 @@
md:flex md:justify-between mb-4">
<!-- Logo & Title -->
<div class="flex flex-col items-center md:items-start gap-2">
- {{ partial "components/logo" (dict "imageClass" "md:w-20 md:h-auto") }}
+ {{ partial "components/logo" (dict "imageClass" "md:w-20 md:h-auto" "ctx" .) }}
<a class="text-8 font-900 text-center tracking-widest
xerox hover:no-underline"
href="{{ .Site.LanguagePrefix }}/"
diff --git a/layouts/_partials/template/post-page.html b/layouts/_partials/template/post-page.html
index 39d8c875..155915cf 100644
--- a/layouts/_partials/template/post-page.html
+++ b/layouts/_partials/template/post-page.html
@@ -8,11 +8,13 @@
{{ partial "components/logo" (dict
"class" "block round-sticker w-14 h-14 lg:w-28 lg:h-28 right-2 lg:-right-20 top-2 lg:top-4 absolute rotate-[3.0deg]"
"imageClass" "block w-full"
+ "ctx" .
) }}
{{ else }}
{{ partial "components/logo" (dict
"class" "block w-[10rem]"
"imageClass" "block w-full"
+ "ctx" .
) }}
{{ end }}
diff --git a/layouts/blank.html b/layouts/blank.html
index d2c6c14f..799c398a 100644
--- a/layouts/blank.html
+++ b/layouts/blank.html
@@ -1,7 +1,7 @@
{{ define "main" }}
<article class="flex flex-col justify-center items-center"
style="height: calc(100dvh - var(--page-margin-y) * 2)">
- {{ partial "components/logo" (dict "imageClass" "w-20 md:w-[7rem] my-4") }}
+ {{ partial "components/logo" (dict "imageClass" "w-20 md:w-[7rem] my-4" "ctx" .) }}
<div class="markdown-body font-mono text-sm">
{{ .Content }}
</div>
diff --git a/layouts/cards/page.html b/layouts/cards/page.html
index 0c528867..7c97ce1a 100644
--- a/layouts/cards/page.html
+++ b/layouts/cards/page.html
@@ -3,6 +3,7 @@
{{ partial "components/logo" (dict
"link" "cards"
"class" "round-sticker absolute -top-4 -right-4 w-16 h-16 z-1 -rotate-5"
+ "ctx" .
"imageClass" "w-full"
) }}
{{ partial "items/card" (dict "context" .) }}
diff --git a/layouts/fictions/page.html b/layouts/fictions/page.html
index ec67e524..81e74f2e 100644
--- a/layouts/fictions/page.html
+++ b/layouts/fictions/page.html
@@ -5,6 +5,7 @@
{{ partial "components/logo" (dict
"link" "fictions/"
"src" "/img/potted-skeleton.svg"
+ "ctx" .
"imageClass" "block w-[10rem]"
"class" "flex justify-center"
) }}
diff --git a/layouts/library/page.html b/layouts/library/page.html
index ffa4ca05..310b19a7 100644
--- a/layouts/library/page.html
+++ b/layouts/library/page.html
@@ -11,6 +11,7 @@
{{ partial "components/logo"
(dict
"link" "library"
+ "ctx" .
"class" "round-sticker absolute w-8 h-8 md:w-20 md:h-20 top-8 -right-8 md:-right-12"
"imageClass" "w-full") }}
</div>
@@ -42,7 +43,7 @@
{{ partial "posts/action-menu.html" . }}
{{ partial "components/back-to-top.html" . }}
-
+
{{ with .Params.authors }}
{{ $author := index . 0 }}