diff options
| author | eltrac <hi@eltr.ac> | 2026-04-07 14:53:17 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-04-07 14:53:17 +0800 |
| commit | 10431bd8f5ff71690ae4e5444e8d7894fd401ae5 (patch) | |
| tree | 62b7fd1b6c1f68d2804f380eb522bcebeb2c8d9f /layouts/library/section.html | |
| parent | 3e0edacc4a0cafa53ede57ebb6f0378c93f3123b (diff) | |
chore: move templates out of site repo
Diffstat (limited to 'layouts/library/section.html')
| -rw-r--r-- | layouts/library/section.html | 85 |
1 files changed, 0 insertions, 85 deletions
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 }} |
