summaryrefslogtreecommitdiff
path: root/layouts/library
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-04-07 14:53:17 +0800
committereltrac <hi@eltr.ac>2026-04-07 14:53:17 +0800
commit10431bd8f5ff71690ae4e5444e8d7894fd401ae5 (patch)
tree62b7fd1b6c1f68d2804f380eb522bcebeb2c8d9f /layouts/library
parent3e0edacc4a0cafa53ede57ebb6f0378c93f3123b (diff)
chore: move templates out of site repo
Diffstat (limited to 'layouts/library')
-rw-r--r--layouts/library/page.html62
-rw-r--r--layouts/library/section.html85
2 files changed, 0 insertions, 147 deletions
diff --git a/layouts/library/page.html b/layouts/library/page.html
deleted file mode 100644
index fbc5d15f..00000000
--- a/layouts/library/page.html
+++ /dev/null
@@ -1,62 +0,0 @@
-{{ define "main" }}
- <article class="h-entry">
- <header class="flex flex-col items-center gap-2">
- <div class="relative border-3 border-solid border-white shadow-lg w-[10rem] md:w-[15rem]"
- style="view-transition-name: book-{{ .File.UniqueID }}">
- <img
- class="lazy block w-full h-auto" loading="lazy"
- data-pagefind-meta="image[src]"
- src="{{ .Params.cover }}"
- />
- {{ 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>
- <h1 class="xerox p-name" data-pagefind-meta="title">{{ .Title }}</h1>
- {{- $rating := .Params.rating -}}
- {{- $fullStars := math.Floor $rating -}}
- <p class="m-0">
- {{ with .Params.authors }}{{ delimit . ", " }}{{ end }}
- </p>
- <p class="m-0">
- {{- range seq $fullStars }}
- <span class="star">⭐</span>
- {{- end -}}
- </p>
- </header>
-
- {{ partial "content" . }}
-
- <div class="text-size-base text-secondary md:flex md:justify-between">
- <p>于 {{ partial "components/date" . }} 读完</p>
- <p>{{ partial "components/tags" . }}</p>
- </div>
-
- {{ partial "components/backlinks" (dict "filename" .File.BaseFileName "type" "library" "context" .) }}
- {{ partial "posts/webmention" . }}
- {{ partial "components/back-to-top.html" . }}
- {{ partial "components/microformats" . }}
-
-
-
- {{ with .Params.authors }}
- {{ $author := index . 0 }}
- {{ $term := index $.Site.Taxonomies.authors $author }}
- {{ if and $term (gt (len $term.Pages) 1) }}
- <h2>我读过的 {{ $author }} 的其它书籍</h2>
- <div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
- {{ range $term.Pages }}
- {{ if ne .File.UniqueID $.File.UniqueID }}
- <div data-tooltip="{{ .Title }}">
- {{ partial "items/book" (dict "ctx" .) }}
- </div>
- {{ end }}
- {{ end }}
- </div>
- {{ end }}
- {{ end }}
- </article>
-{{ end }}
diff --git a/layouts/library/section.html b/layouts/library/section.html
deleted file mode 100644
index bb297a0d..00000000
--- a/layouts/library/section.html
+++ /dev/null
@@ -1,85 +0,0 @@
-{{ define "main" }}
-
-{{ $isLibraryHome := eq .RelPermalink "/library/" }}
-{{ $books := .RegularPages }}
-{{ if $isLibraryHome }}
- {{ $sections := (sort .Sections "value" "asc") }}
- {{ range $sections }}
- {{ $books = $books | append .RegularPages }}
- {{ end }}
-{{ end }}
-
-{{ $years := slice }}
-{{ range .Sections }}
- {{ $years = $years | append .Title }}
-{{ end }}
-{{ $years = $years | collections.Reverse }}
-
- <article class="pagefind-exclude">
- <div class="markdown-body">{{ .Content }}</div>
-
- <div>
-
- {{ if $isLibraryHome }}
- {{ partial "components/section-title" (dict
- "Left" "最近读的书"
- "Right" (printf "共 %d 篇书评" (len $books))
- )}}
- {{ end }}
-
- <div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
- {{ $booksToShow := $books }}
- {{ if $isLibraryHome }}
- {{ $booksToShow = first 18 $books }}
- {{ end }}
- {{ range $i, $book := $booksToShow }}
- <div class="{{ if gt $i 15 }}hidden md:block{{ end }}">
- {{ partial "items/book" (dict
- "ctx" $book
- ) }}
- </div>
- {{ end }}
- </div>
-
-
- <!-- ONLY SHOW IN HOME SECTION / START -->
- {{ if $isLibraryHome }}
-
- <!-- === year list === -->
- <div class="flex items-center my-8 justify-between gap-4">
- <a href="/library/{{ now.Year }}" class="small-button">
- {{ T "library.viewAllThisYear" }}
- <span class="text-secondary">→</span>
- </a>
- <p class="my-0">
- {{ $currentYear := printf "%d" now.Year }}
- {{ range $i, $year := $years }}
- {{ if ne $year $currentYear }}
- <a class="text-secondary" href="{{ printf "/library/%s/" $year }}">{{ $year }} 年</a>
- {{ if not (eq $i (sub (len $years) 1)) }}·{{ end }}
- {{ end }}
- {{ end }}
- </p>
- </div>
-
- <!-- === good books section === -->
- {{ $goodBooks := where $books ".Params.rating" "==" 5 }}
- {{ partial "components/section-title" (dict
- "Left" "推荐好书"
- "Right" (printf "共 %d 本" (len $goodBooks))
- )}}
- <div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
- {{ range $goodBooks }}
- {{ partial "items/book" (dict
- "ctx" .
- "NoViewTransition" true
- ) }}
- {{ end }}
- </div>
-
- {{ end }}
- <!-- ONLY SHOW IN HOME SECTION / END -->
-
- </div>
- </article>
-{{ end }}