summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-03-23 15:55:08 +0800
committereltrac <hi@eltr.ac>2026-03-23 15:55:08 +0800
commitae705282e6771b31fa953186e5de842695d11253 (patch)
treeb82f89310a8d2727961f694a636e8884af6e447d
parente5557ff9374b102810eaedc346b804d04928b2e3 (diff)
refactor: move recurring elements to baseof.*.html
recurring elements: header, footer and home-nav
-rw-r--r--layouts/_partials/header.html2
-rw-r--r--layouts/_partials/home/home-nav.html2
-rw-r--r--layouts/archive.html2
-rw-r--r--layouts/article/section.html4
-rw-r--r--layouts/baseof.html20
-rw-r--r--layouts/baseof.page.html14
-rw-r--r--layouts/baseof.section.html15
-rw-r--r--layouts/cards/section.html3
-rw-r--r--layouts/fiction/section.html3
-rw-r--r--layouts/home.html2
-rw-r--r--layouts/library/section.html4
-rw-r--r--layouts/page.html2
-rw-r--r--layouts/tags/taxonomy.html2
-rw-r--r--layouts/taxonomy.html2
-rw-r--r--layouts/term.html2
-rw-r--r--layouts/weekly/section.html4
16 files changed, 42 insertions, 41 deletions
diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html
index 1b249f1e..279c822b 100644
--- a/layouts/_partials/header.html
+++ b/layouts/_partials/header.html
@@ -1,5 +1,5 @@
<header class="pagefind-exclude
- md:flex md:justify-between mb-4">
+ md:flex md:justify-between mb-4 mx-auto max-w-[var(--page-width)]">
<!-- Logo & Title -->
<div class="flex items-center justify-center gap-5
md:flex-col md:items-start md:justify-start md:gap-2">
diff --git a/layouts/_partials/home/home-nav.html b/layouts/_partials/home/home-nav.html
index 4c0de915..ce66e563 100644
--- a/layouts/_partials/home/home-nav.html
+++ b/layouts/_partials/home/home-nav.html
@@ -1,5 +1,5 @@
{{ if eq .Site.Language.Lang "zh" }}
-<nav id="home-nav" class="relative w-full ps-0 flex list-none gap-4 text-size-sm">
+<nav id="home-nav" class="relative w-full ps-0 flex list-none gap-4 text-size-sm mx-auto max-w-[var(--page-width)]">
{{ range .Site.Params.homenav }}
{{ partial "home/home-nav-item" (dict
"text" .name
diff --git a/layouts/archive.html b/layouts/archive.html
index 87bafab2..82f0f49f 100644
--- a/layouts/archive.html
+++ b/layouts/archive.html
@@ -1,6 +1,5 @@
{{ define "main" }}
<article>
- {{ partial "header" . }}
{{ partial "taxonomy/pagefind" . }}
<div class="post-content text-size-lg">
{{ range .Site.RegularPages.GroupByDate "2006" }}
@@ -21,5 +20,4 @@
{{ end }}
</div>
</article>
-{{ partial "footer.html" . }}
{{ end }}
diff --git a/layouts/article/section.html b/layouts/article/section.html
index b56b30eb..5072f416 100644
--- a/layouts/article/section.html
+++ b/layouts/article/section.html
@@ -1,11 +1,8 @@
{{ define "main" }}
-
{{ $pages := .Pages }}
{{ $categories := slice }}
<article>
- {{ partial "header.html" . }}
- {{ partial "home/home-nav" . }}
<div class="posts-list pagefind-exclude">
<div class="markdown-body">{{ .Content }}</div>
@@ -38,5 +35,4 @@
{{ end }}
</div>
</article>
- {{ partial "footer.html" . }}
{{ end }}
diff --git a/layouts/baseof.html b/layouts/baseof.html
index 24d4011e..f26dea17 100644
--- a/layouts/baseof.html
+++ b/layouts/baseof.html
@@ -1,12 +1,14 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}" prefix="og: http://ogp.me/ns#">
-{{ partial "head.html" . }}
-<body>
- {{ partial "components/svg-filters" . }}
- <main class="my-[var(--page-margin-y)] relative">
- {{ block "main" . }}{{ end }}
- {{ partial "components/shade-mask" . }}
- </main>
- {{ partial "scripts.html" . }}
-</body>
+ {{ partial "head.html" . }}
+ <body>
+ <main class="my-[var(--page-margin-y)] relative">
+ {{ partial "header.html" . }}
+ {{ block "main" . }}{{ end }}
+ {{ partial "footer.html" . }}
+ </main>
+ {{ partial "components/svg-filters" . }}
+ {{ partial "components/shade-mask" . }}
+ {{ partial "scripts.html" . }}
+ </body>
</html>
diff --git a/layouts/baseof.page.html b/layouts/baseof.page.html
new file mode 100644
index 00000000..753d37ff
--- /dev/null
+++ b/layouts/baseof.page.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html lang="{{ .Site.LanguageCode }}" prefix="og: http://ogp.me/ns#">
+ {{ partial "head" . }}
+ <body>
+ <main class="my-[var(--page-margin-y)] relative">
+ {{ if eq .Section "" }}{{ partial "header" . }}{{ end }}
+ {{ block "main" . }}{{ end }}
+ {{ if eq .Section "" }}{{ partial "footer" . }}{{ end }}
+ </main>
+ {{ partial "components/svg-filters" . }}
+ {{ partial "components/shade-mask" . }}
+ {{ partial "scripts" . }}
+ </body>
+</html>
diff --git a/layouts/baseof.section.html b/layouts/baseof.section.html
new file mode 100644
index 00000000..5fc6ecef
--- /dev/null
+++ b/layouts/baseof.section.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang="{{ .Site.LanguageCode }}" prefix="og: http://ogp.me/ns#">
+ {{ partial "head.html" . }}
+ <body>
+ <main class="my-[var(--page-margin-y)] relative">
+ {{ partial "header.html" . }}
+ {{ partial "home/home-nav" . }}
+ {{ block "main" . }}{{ end }}
+ {{ partial "footer.html" . }}
+ </main>
+ {{ partial "components/svg-filters" . }}
+ {{ partial "components/shade-mask" . }}
+ {{ partial "scripts.html" . }}
+ </body>
+</html>
diff --git a/layouts/cards/section.html b/layouts/cards/section.html
index 513a2424..2ea36990 100644
--- a/layouts/cards/section.html
+++ b/layouts/cards/section.html
@@ -1,6 +1,5 @@
{{ define "main" }}
<article>
- {{ partial "header.html" . }}
<div class="bg-red-200 text-red b-1 b-solid b-red px-4 py-2 rd-md">
<p>「卡片」分区已经弃用,这里的内容不会再更新。</p>
@@ -26,7 +25,5 @@
href="{{ .RelPermalink }}">{{ .Title }}</a>
{{- end }}
</div>
-
- {{ partial "footer.html" . }}
</article>
{{ end }}
diff --git a/layouts/fiction/section.html b/layouts/fiction/section.html
index 997613e4..beda5ba2 100644
--- a/layouts/fiction/section.html
+++ b/layouts/fiction/section.html
@@ -1,7 +1,5 @@
{{ define "main" }}
<article>
- {{ partial "header.html" . }}
- {{ partial "home/home-nav" . }}
<div class="markdown-body">{{ .Content }}</div>
<div class="pagefind-exclude my-8">
<div class="flex flex-wrap justify-around gap-8">
@@ -28,5 +26,4 @@
</div>
</div>
</article>
- {{ partial "footer.html" . }}
{{ end }}
diff --git a/layouts/home.html b/layouts/home.html
index cd95ce2b..a74fee5d 100644
--- a/layouts/home.html
+++ b/layouts/home.html
@@ -1,10 +1,8 @@
{{ define "main" }}
{{ partial "home/microformats" . }}
<article>
- {{ partial "header" . }}
{{ partial "home/home-nav" . }}
{{ partial "home/latest-posts" . }}
{{ partial "home/more-links" . }}
</article>
-{{ partial "footer.html" . }}
{{ end }}
diff --git a/layouts/library/section.html b/layouts/library/section.html
index cb7e1734..bb297a0d 100644
--- a/layouts/library/section.html
+++ b/layouts/library/section.html
@@ -16,9 +16,6 @@
{{ $years = $years | collections.Reverse }}
<article class="pagefind-exclude">
- {{ partial "header.html" . }}
- {{ partial "home/home-nav" . }}
-
<div class="markdown-body">{{ .Content }}</div>
<div>
@@ -85,5 +82,4 @@
</div>
</article>
- {{ partial "footer.html" . }}
{{ end }}
diff --git a/layouts/page.html b/layouts/page.html
index 14fa6879..ab703e2e 100644
--- a/layouts/page.html
+++ b/layouts/page.html
@@ -1,11 +1,9 @@
{{ define "main" }}
<article>
- {{ partial "header.html" . }}
<div id="post-content" class="post-content markdown-body text-size-md md:text-size-lg leading-loose"
style="view-transition-name: post-content-{{ .File.UniqueID }}">
{{ partial "posts/toc" . }}
{{ partial "utils/render" .Content }}
</div>
</article>
- {{ partial "footer.html" . }}
{{ end }}
diff --git a/layouts/tags/taxonomy.html b/layouts/tags/taxonomy.html
index a0c38a40..d716e87e 100644
--- a/layouts/tags/taxonomy.html
+++ b/layouts/tags/taxonomy.html
@@ -1,6 +1,5 @@
{{ define "main" }}
<article>
- {{ partial "header" . }}
<div class="post-content markdown-body text-size-md md:text-size-lg leading-loose">
{{ partial "utils/render" .Content }}
</div>
@@ -10,5 +9,4 @@
<h2>开始速切!</h2>
<p class="text-secondary text-sm">快速切换到你想去的地方。</p>
{{ partial "taxonomy/pagefind" . }}
-{{ partial "footer.html" . }}
{{ end }}
diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html
index 600d4d03..4ae858d9 100644
--- a/layouts/taxonomy.html
+++ b/layouts/taxonomy.html
@@ -1,6 +1,5 @@
{{ define "main" }}
<article>
- {{ partial "header" . }}
<div class="post-content markdown-body text-size-md md:text-size-lg leading-loose">
{{ partial "utils/render" .Content }}
</div>
@@ -11,5 +10,4 @@
<p>这些文章系列已经不再更新。</p>
{{ partial "taxonomy/archived-categories.html" . }}
</article>
- {{ partial "footer.html" . }}
{{ end }}
diff --git a/layouts/term.html b/layouts/term.html
index 216f4d12..743fc69e 100644
--- a/layouts/term.html
+++ b/layouts/term.html
@@ -1,6 +1,5 @@
{{ define "main" }}
<article>
- {{ partial "header" . }}
<section>
{{ with .Content }}
<div class="markdown-body text-size-lg md:text-size-xl">
@@ -13,5 +12,4 @@
{{ partial "term/term-books" . }}
</section>
</article>
- {{ partial "footer" . }}
{{ end }}
diff --git a/layouts/weekly/section.html b/layouts/weekly/section.html
index 14bb4db4..c1bc53b9 100644
--- a/layouts/weekly/section.html
+++ b/layouts/weekly/section.html
@@ -1,11 +1,8 @@
{{ define "main" }}
-
{{ $pages := .Pages }}
{{ $categories := slice }}
<article>
- {{ partial "header.html" . }}
- {{ partial "home/home-nav" . }}
<div class="posts-list pagefind-exclude">
<div class="markdown-body">{{ .Content }}</div>
@@ -41,5 +38,4 @@
{{ end }}
</div>
</article>
- {{ partial "footer.html" . }}
{{ end }}