diff options
| author | Eltrac <hi@guhub.cn> | 2025-11-27 23:35:37 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-11-27 23:35:37 +0800 |
| commit | 5cb1c7eb72fad939bcc76be11e4b6149f37618e1 (patch) | |
| tree | 338e937126b595840885a529b67c6b62b4ddbdbc /layouts/_partials | |
| parent | d56407e244a6b74f6f913507d63e03377cc86308 (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
Former-commit-id: 9a478cf5ee77a32b83dbe8f03d7ed8e83247937f
Diffstat (limited to 'layouts/_partials')
| -rw-r--r-- | layouts/_partials/home/latest-posts.html | 6 | ||||
| -rw-r--r-- | layouts/_partials/section-categories.html | 20 | ||||
| -rw-r--r-- | layouts/_partials/template/post-page.html | 47 |
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> |
