summaryrefslogtreecommitdiff
path: root/layouts/_partials
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-11-27 23:35:37 +0800
committerEltrac <hi@guhub.cn>2025-11-27 23:35:37 +0800
commit9a478cf5ee77a32b83dbe8f03d7ed8e83247937f (patch)
tree68036ba1156d29485c8f0f2eebdf9bb84dfbe627 /layouts/_partials
parentb0247ca24e9f5fd10ede61963d15e416f54156b7 (diff)
feat: adapt to new content system - remove more posts link in homepage - more
latest content (posts, essays, library, fictions...) in homepage - use the same template for posts and essays - new post section list style - show section-specific categories in section page
Diffstat (limited to 'layouts/_partials')
-rw-r--r--layouts/_partials/home/latest-posts.html6
-rw-r--r--layouts/_partials/section-categories.html20
-rw-r--r--layouts/_partials/template/post-page.html47
3 files changed, 68 insertions, 5 deletions
diff --git a/layouts/_partials/home/latest-posts.html b/layouts/_partials/home/latest-posts.html
index 2a0beccd..ac015111 100644
--- a/layouts/_partials/home/latest-posts.html
+++ b/layouts/_partials/home/latest-posts.html
@@ -1,7 +1,7 @@
<!-- Latest Posts -->
<section class="pagefind-exclude flex flex-col my-4">
{{ $firstPost := true }}
- {{ range first 5 (where site.RegularPages "Type" "in" site.Params.mainSections) }}
+ {{ range first 12 (where site.RegularPages "Type" "in" site.Params.mainSections) }}
{{ partial "items/post" (dict
"ctx" .
"showSummary" $firstPost
@@ -9,7 +9,3 @@
{{ $firstPost = false }}
{{ end }}
</section>
-
-<a href="/posts" class="small-button">
- {{ T "moreLinks.posts" }} →
-</a>
diff --git a/layouts/_partials/section-categories.html b/layouts/_partials/section-categories.html
new file mode 100644
index 00000000..5e92bcc3
--- /dev/null
+++ b/layouts/_partials/section-categories.html
@@ -0,0 +1,20 @@
+{{ $categories := slice }}
+{{ range . }}
+ {{ with .Params.categories }}
+ {{ if not (in $categories .) }}
+ {{ $categories = $categories | append . }}
+ {{ end }}
+ {{ end }}
+{{ end }}
+
+<div class="flex gap-2 flex-wrap">
+ {{ range $categories }}
+ <a href="/categories/{{ . }}/"
+ class="text-size-lg px-3 py-2
+ transition-colors duration-300 rounded-xl hover:no-underline
+ bg-slate-2/50 dark:bg-neutral-800/50
+ hover:bg-[var(--text-color)] hover:text-[var(--block-background-color)]">
+ {{ . }}
+ </a>
+ {{ end }}
+</div>
diff --git a/layouts/_partials/template/post-page.html b/layouts/_partials/template/post-page.html
new file mode 100644
index 00000000..39d8c875
--- /dev/null
+++ b/layouts/_partials/template/post-page.html
@@ -0,0 +1,47 @@
+<article>
+ <!-- Post Header -->
+ <header
+ style="view-transition-name: post-{{ .File.UniqueID }}"
+ class="mb-8 relative"
+ >
+ {{ if .Params.banner }}
+ {{ 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"
+ ) }}
+ {{ else }}
+ {{ partial "components/logo" (dict
+ "class" "block w-[10rem]"
+ "imageClass" "block w-full"
+ ) }}
+ {{ end }}
+
+ {{ partial "posts/banner" . }}
+ <!-- Title and Subtitle -->
+ <h1 class="text-size-3xl font-900 xerox">
+ <span data-pagefind-meta="title">{{ .Title }}</span>
+ {{ with .Params.subtitle }}
+ <small class="block text-secondary font-italic text-size-xl">{{ . }}</small>
+ {{ end }}
+ </h1>
+ <!-- Post Meta -->
+ <div class="flex flex-wrap items-center gap-2">
+ <span class="text-secondary">{{ partial "components/date" . }}</span>
+ {{ if or .Params.categories .Params.tags }}<span>·</span>{{ end }}
+ {{ partial "components/category-pill" . }}
+ {{ partial "components/tags" . }}
+ </div>
+ </header>
+
+ <!-- Post Content -->
+ <div class="min-h-[60%] leading-loose mb-8 markdown-body text-size-lg md:text-size-xl"
+ style="view-transition-name: post-content-{{ .File.UniqueID }}">
+ {{ partial "posts/toc" . }}
+ <div id="post-content">{{ .Content }}</div>
+ {{ partial "posts/endnotes" . }}
+ </div>
+
+ {{ partial "posts/action-menu.html" . }}
+ {{ partial "posts/now-read-this.html" . }}
+ {{ partial "components/back-to-top.html" . }}
+</article>