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/_partials | |
| parent | 3e0edacc4a0cafa53ede57ebb6f0378c93f3123b (diff) | |
chore: move templates out of site repo
Diffstat (limited to 'layouts/_partials')
58 files changed, 0 insertions, 1412 deletions
diff --git a/layouts/_partials/components/back-to-top.html b/layouts/_partials/components/back-to-top.html deleted file mode 100644 index 157fbe7b..00000000 --- a/layouts/_partials/components/back-to-top.html +++ /dev/null @@ -1,16 +0,0 @@ -<div id="back2top" class="fixed -top-25 left-0 right-0 z-30 - flex justify-center items-center transition-all animate-head-shake - bg-linear-to-t bg-gradient-from-transparent bg-gradient-to-zinc"> - <button id="back2top-button" - class="block bg-transparent mt-5 flex flex-col items-center"> - <img src="/img/bat.svg" - class="block w-8 h-8 dark:invert-100 drop-shadow-xl" - alt="Back to top" - /> - <p id="back2top-instruction" - class="text-size-xs bg-black/80 text-white px-2 py-1 border rounded"> - {{ T "back2top" . }} - </p> - </button> -</div> - diff --git a/layouts/_partials/components/backlinks.html b/layouts/_partials/components/backlinks.html deleted file mode 100644 index e97c295c..00000000 --- a/layouts/_partials/components/backlinks.html +++ /dev/null @@ -1,37 +0,0 @@ -{{ $type := .type }} -{{ $filename := .filename }} -{{ $ctx := .context }} -{{ $referencedBy := slice }} - -{{ if eq $type "library" }} - {{ range $ctx.Site.Pages }} - {{ if and (isset .Params "mentioned_books") (in .Params.mentioned_books $filename) }} - {{ $referencedBy = $referencedBy | append . }} - {{ end }} - {{ end }} -{{ else if eq $type "cards" }} - {{ range $ctx.Site.Pages }} - {{ if and (isset .Params "related_cards") (in .Params.related_cards $filename) }} - {{ $referencedBy = $referencedBy | append . }} - {{ end }} - {{ end }} -{{ end }} - -{{- /* 如果有文章引用这个卡片,就显示它们 */ -}} -{{ if gt (len $referencedBy) 0 }} -<section class="related-posts post-content my-5"> - <h2 class="text-size-base m-0 flex items-center gap-2"> - <span>反向链接</span> - <span class="inline-block bg-blockBg rounded-full px-1 text-secondary cursor-help text-size-sm" - data-tooltip="这里列出了引用了该页面的其他文章">?</span> - </h2> - <ul class="my-4 list-none ps-4"> - {{- range $referencedBy }} - <li class="flex gap-4"> - <span class="text-secondary">→</span> - <a href="{{ .Permalink }}">{{ .Title }}</a> - </li> - {{- end }} - </ul> -</section> -{{ end }} diff --git a/layouts/_partials/components/category-pill.html b/layouts/_partials/components/category-pill.html deleted file mode 100644 index 6146f0d4..00000000 --- a/layouts/_partials/components/category-pill.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ with .GetTerms "categories" }} - {{ with index . 0 }} - <a class="post-category text-secondary" href="{{ .RelPermalink }}"> - <span>《{{ .LinkTitle }}》</span> - </a> - {{ end }} -{{ end }} diff --git a/layouts/_partials/components/date.html b/layouts/_partials/components/date.html deleted file mode 100644 index 398e2b1d..00000000 --- a/layouts/_partials/components/date.html +++ /dev/null @@ -1,31 +0,0 @@ -{{ if .Date }} - {{ $hour := .Date.Hour }} - {{ $fuzzyTimes := slice - (dict "limit" 5 "label" (T "fuzzyTimes.afterMidnight")) - (dict "limit" 7 "label" (T "fuzzyTimes.earlyMorning")) - (dict "limit" 11 "label" (T "fuzzyTimes.morning")) - (dict "limit" 13 "label" (T "fuzzyTimes.noon")) - (dict "limit" 17 "label" (T "fuzzyTimes.afternoon")) - (dict "limit" 19 "label" (T "fuzzyTimes.evening")) - (dict "limit" 22 "label" (T "fuzzyTimes.night")) - }} - {{ $fuzzyTime := (T "fuzzyTimes.midnight") }} {{/* default */}} - {{ range $fuzzyTimes }} - {{ if lt $hour .limit }} - {{ $fuzzyTime = .label }} - {{ break }} - {{ end }} - {{ end }} - - <time class="post-date dt-published" - datetime="{{ .Date.Format "2006-01-02 15:04:05 MST" }}" - data-pagefind-sort="date[datetime], weight[data-weight]" - data-weight="20"> - {{ if eq .Site.Language.Lang "zh" }} - {{ .Date.Format "2006年1月2日" }} - {{ else }} - {{ .Date.Format "January 2, 2006" }}, - {{ end }} - {{ $fuzzyTime }} - </time> -{{ end }} diff --git a/layouts/_partials/components/logo.html b/layouts/_partials/components/logo.html deleted file mode 100644 index 88c2284e..00000000 --- a/layouts/_partials/components/logo.html +++ /dev/null @@ -1,18 +0,0 @@ -{{ $ctx := .ctx }} -{{ $link := .link | default "" }} -{{- $src := - (or .ctx.Params.logo - (printf "%s%s" - (.ctx.Site.Params.assetBaseUrl) - (.ctx.Site.Params.logo))) --}} -{{ $class := .class | default "" }} -{{ $imageClass := .imageClass | default "" }} - -<a href="{{ $ctx.Site.LanguagePrefix }}/{{ $link }}" - class="title-image-container {{ $class }}"> - <img src="{{ $src }}" alt="Logo" - class="dark:invert title-image {{ $imageClass }}" - style="view-transition-name: title-image" - /> -</a> diff --git a/layouts/_partials/components/microformats.html b/layouts/_partials/components/microformats.html deleted file mode 100644 index 8cd64f50..00000000 --- a/layouts/_partials/components/microformats.html +++ /dev/null @@ -1,9 +0,0 @@ -<div class="hidden p-author h-card pt"> - <img class="u-photo icon" alt="{{ .Site.Params.author.name }}" - src="{{ printf "%s%s" .Site.Params.assetBaseUrl .Site.Params.author.avatar }}" /> - <a class="p-name u-url" href="{{ .Site.BaseURL }}" - >{{ .Site.Params.author.name }}</a - > -</div> - -<a href="{{ .Permalink }}" class="u-url hidden"></a> diff --git a/layouts/_partials/components/section-title.html b/layouts/_partials/components/section-title.html deleted file mode 100644 index 698f71e8..00000000 --- a/layouts/_partials/components/section-title.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ $left := .Left }} -{{ $right := .Right }} -<h2 class="border-b-2 border-b-solid border-[var(--border-color)] - py-2 text-6 flex justify-between items-center - sticky top-0 bg-[var(--background-color)] z-1"> - <span>{{ $left }}</span> - <span class="font-mono text-secondary text-3"> - {{ $right }} - </span> -</h2> diff --git a/layouts/_partials/components/shade-mask.html b/layouts/_partials/components/shade-mask.html deleted file mode 100644 index c53415d8..00000000 --- a/layouts/_partials/components/shade-mask.html +++ /dev/null @@ -1,7 +0,0 @@ -<!-- 上渐变 --> -<div class="pointer-events-none fixed top-0 left-0 w-full h-22 z-20 - bg-gradient-to-b from-bg to-transparent "></div> - -<!-- 下渐变 --> -<div class="pointer-events-none fixed bottom-0 left-0 w-full h-22 z-20 - bg-gradient-to-t from-bg to-transparent "></div> diff --git a/layouts/_partials/components/svg-filters.html b/layouts/_partials/components/svg-filters.html deleted file mode 100644 index 5e68d6ec..00000000 --- a/layouts/_partials/components/svg-filters.html +++ /dev/null @@ -1,4 +0,0 @@ -<div style="display:none;"> - <svg class="hidden" xmlns="http://www.w3.org/2000/svg"><filter id="x" height="500%"><feTurbulence baseFrequency="0.01 0.02" numOctaves="2" result="t0"></feTurbulence><feDisplacementMap in="SourceGraphic" in2="t0" result="d0" scale="4"></feDisplacementMap><feComposite in="SourceGraphic" in2="d0" operator="atop" result="0"></feComposite><feTurbulence baseFrequency="1" numOctaves="2" result="t1"></feTurbulence><feDisplacementMap in="0" in2="t1" result="d1" scale="1"></feDisplacementMap><feComposite in="0" in2="d1" operator="atop" result="1"></feComposite><feOffset dx="-3" dy="-3" in="1"></feOffset></filter></svg> - <svg class="hidden" xmlns="http://www.w3.org/2000/svg"><filter id="xs"><feTurbulence baseFrequency="0.01 0.02" numOctaves="2" result="t0"></feTurbulence><feDisplacementMap in="SourceGraphic" in2="t0" result="d0" scale="4"></feDisplacementMap><feComposite in="SourceGraphic" in2="d0" operator="atop" result="0"></feComposite><feTurbulence baseFrequency="1" numOctaves="2" result="t1"></feTurbulence><feDisplacementMap in="0" in2="t1" result="d1" scale="1"></feDisplacementMap><feComposite in="0" in2="d1" operator="atop" result="1"></feComposite><feOffset dx="-3" dy="-3" in="1"></feOffset></filter></svg> -</div> diff --git a/layouts/_partials/components/tags.html b/layouts/_partials/components/tags.html deleted file mode 100644 index 78d87f5b..00000000 --- a/layouts/_partials/components/tags.html +++ /dev/null @@ -1,3 +0,0 @@ -{{ range .Params.tags }} -<a class="tag text-secondary no-underline!" href="{{ site.LanguagePrefix }}/tags/{{ lower . | urlize }}/">#{{ . }}</a> -{{ end }} diff --git a/layouts/_partials/components/wordcount.html b/layouts/_partials/components/wordcount.html deleted file mode 100644 index 526acaa4..00000000 --- a/layouts/_partials/components/wordcount.html +++ /dev/null @@ -1 +0,0 @@ -<span>{{ printf (T "postPage.wordcount") .WordCount }}</span> diff --git a/layouts/_partials/content.html b/layouts/_partials/content.html deleted file mode 100644 index c3c61cd5..00000000 --- a/layouts/_partials/content.html +++ /dev/null @@ -1,9 +0,0 @@ -<div class="e-content min-h-[60%] leading-loose mb-8 markdown-body text-size-md md:text-size-lg" - style="view-transition-name: post-content-{{ .File.UniqueID }}"> - {{ partial "posts/toc" . }} - <div id="post-content"> - {{ partial "utils/render" .Content }} - </div> - {{ partial "posts/endnotes" . }} -</div> - diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html deleted file mode 100644 index bf28dc51..00000000 --- a/layouts/_partials/footer.html +++ /dev/null @@ -1,39 +0,0 @@ -<footer class="pagefind-exclude my-8 mx-auto font-mono px-4 md:px-0 - text-sm - md:w-[var(--page-width)] md:flex md:justify-between"> - <!-- copyright --> - <section> - <p class="copyright">© 2022-{{ now | dateFormat "2006" }} <a href="https://www.eltr.ac/" target="_blank">Eltrac</a></p> - <p class="license">{{ T "footer.licenseStatement" (printf "<a href=\"https://creativecommons.org/licenses/by-sa/4.0/\" target=\"_blank\">CC BY-SA 4.0</a>") | safeHTML }}</p> - </section> - <!-- links --> - <section class="flex justify-between items-center - md:justify-start md:flex-col md:items-end"> - - <!-- IndieWeb ring --> - <p class="inline-flex justify-center items-center gap-2"> - <a href="https://xn--sr8hvo.ws/previous">←</a> - <a href="https://xn--sr8hvo.ws">IndieWeb ring</a> - <a href="https://xn--sr8hvo.ws/next">→</a> - </p> - <!-- External Links --> - <ul class="list-style-none flex items-center gap-2 ps-0 m-0 md:justify-end"> - {{ range .Site.Params.footerExternalLinks }} - <li class="inline-flex items-center"> - <a href="{{ .link }}" title="{{ .name }}" target="_blank" data-tooltip - class="transition opacity-70 hover:opacity-100"> - <img - class="h-4 w-auto inline-block grayscale dark:invert" - src="{{ .icon }}" - alt="{{ .name }} icon." - loading="lazy" - width="1rem" - height="1rem" - /> - </a> - </li> - {{ end }} - </ul> - - </section> -</footer> diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html deleted file mode 100644 index 3a8cd25c..00000000 --- a/layouts/_partials/head.html +++ /dev/null @@ -1,10 +0,0 @@ -<head> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - <link rel="preconnect" href="https://r2.eltr.ac" /> - {{ hugo.Generator }} - {{ partial "head/siteinfo" . }} - {{ partial "head/verification" . }} - {{ partial "head/css" . }} - {{ partial "head/scripts" . }} -</head> diff --git a/layouts/_partials/head/css.html b/layouts/_partials/head/css.html deleted file mode 100644 index 7ff49fd5..00000000 --- a/layouts/_partials/head/css.html +++ /dev/null @@ -1,19 +0,0 @@ -<!-- Pagefind --> -<link rel="stylesheet" href="/pagefind/pagefind-ui.css"> - -<!-- Extra --> -{{ range .Site.Params.extraCSSFiles -}} -<link - rel="stylesheet" - href="{{ $.Site.Params.staticPrefix }}{{ . | relURL }}" -/> -{{- end }} - -<!-- theme css --> -{{ with resources.Get "css/uno.css" | minify }} -<style>{{ .Content | safeCSS }}</style> -{{ end }} - -{{ with resources.Get "css/main.scss" | css.Sass | minify }} -<style>{{ .Content | safeCSS }}</style> -{{ end }} diff --git a/layouts/_partials/head/scripts.html b/layouts/_partials/head/scripts.html deleted file mode 100644 index f067944c..00000000 --- a/layouts/_partials/head/scripts.html +++ /dev/null @@ -1,4 +0,0 @@ -{{ with resources.Get "js/darkmode.js" }} -<script>{{ .Content | safeJS }}</script> -{{ end }} - diff --git a/layouts/_partials/head/siteinfo.html b/layouts/_partials/head/siteinfo.html deleted file mode 100644 index e251a009..00000000 --- a/layouts/_partials/head/siteinfo.html +++ /dev/null @@ -1,59 +0,0 @@ -<!-- Link preview meta tags --> -{{- $isHome := .IsHome -}} -{{- $title := cond $isHome .Site.Title .Title -}} -{{- $description := cond $isHome .Site.Params.description (default .Summary .Description | plainify) -}} -{{- $ogType := cond $isHome "website" "article" -}} -{{- $image := cond (isset .Params "banner") - .Params.banner - (cond (isset .Params "cover") - .Params.cover - .Site.Params.favicon) --}} - -<title>{{ $title }}</title> -<link rel="canonical" href="{{ .Permalink }}" /> -<meta name="author" content="{{ .Site.Params.author.name }}" /> -<link rel="icon" href="{{ .Site.Params.favicon }}"> -<meta property="og:url" content="{{ .Permalink }}" /> -<meta property="og:title" content="{{ $title }}" /> -<meta property="og:type" content="{{ $ogType }}" /> -<meta property="og:description" content="{{ $description }}" /> -<meta name="description" content="{{ $description }}" /> -<meta property="og:locale" content="{{ .Site.LanguageCode }}" /> -<meta property="og:image" content="{{ $image }}" /> - -<!-- RSS --> -<link rel="alternate" type="application/atom+xml" href="{{.Site.BaseURL}}index.xml" title="{{ .Site.Title }}"> -<link href="{{ .Site.Params.staticPrefix }}{{ "index.xml" | relURL }}" rel="alternate" type="application/rss+xml" - title="{{ .Site.Title }}"> - -<!-- JSON-LD --> -<script type="application/ld+json"> - { - "@context" : "http://schema.org", - "@type" : "BlogPosting", - "mainEntityOfPage": { - "@type": "WebPage", - "@id": "{{ .Site.BaseURL }}" - }, - "articleSection" : "{{ .Section }}", - "name" : "{{ .Title }}", - "headline" : "{{ .Title }}", - {{ if .IsHome -}} - "description" : "{{ .Site.Params.description | plainify }}", - {{- else -}} - "description" : "{{ default .Summary .Description | plainify }}", - {{- end }} - "inLanguage" : "zh-CN", - "author" : "{{ .Site.Params.author.name }}", - "creator" : "{{ .Site.Params.author.name }}", - "publisher": "{{ .Site.Params.author.name }}", - "accountablePerson" : "{{ .Site.Params.author.name }}", - "copyrightHolder" : "{{ .Site.Params.author.name }}", - "copyrightYear" : "{{ .Date.Format "2006" }}", - "datePublished": "{{ .Date }}", - "dateModified" : "{{ .Date }}", - "url" : "{{ .Permalink }}", - "keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{ end }} ] - } -</script> diff --git a/layouts/_partials/head/verification.html b/layouts/_partials/head/verification.html deleted file mode 100644 index 11705435..00000000 --- a/layouts/_partials/head/verification.html +++ /dev/null @@ -1,10 +0,0 @@ -<!-- verify my identity --> -<link rel="me" href="https://c7.io/@eltrac"> -<link rel="me" href="https://akk.eltr.ac/@eltrac"> -<link rel="me" href="https://github.com/BigCoke233" /> -<link rel="me" href="mailto:hi@guhub.cn" /> -<link rel="me" href="mailto:hi@eltr.ac" /> -<meta name="fediverse:creator" content="@eltrac@eltr.ac"> - -<!-- webmention --> -<link rel="webmention" href="https://wm.geedea.pro/endpoint" /> diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html deleted file mode 100644 index 279c822b..00000000 --- a/layouts/_partials/header.html +++ /dev/null @@ -1,28 +0,0 @@ -<header class="pagefind-exclude - 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"> - {{ partial "components/logo" (dict "imageClass" "w-12 md:w-20 h-auto" "ctx" .) }} - <a class="text-8 font-900 text-center tracking-widest - xerox hover:no-underline" - href="{{ .Site.LanguagePrefix }}/" - > - {{ if .IsHome }} - {{ .Site.Title }} - {{ else }} - {{ if eq .Kind "term" }} - {{ if eq .Data.Singular "tag" }}#{{ else }}+{{ end }} - {{ end }} - {{ .Title }} - {{ end }} - </a - > - </div> - <!-- Navigation --> - <div class="flex justify-center items-center gap-3 text-size-base - md:flex-col md:items-end md:justify-start md:pl-6"> - {{ partial "header/navigation" . }} - {{ partial "header/other-navigation" . }} - </div> -</header> diff --git a/layouts/_partials/header/navigation.html b/layouts/_partials/header/navigation.html deleted file mode 100644 index 168d614f..00000000 --- a/layouts/_partials/header/navigation.html +++ /dev/null @@ -1,13 +0,0 @@ -<nav class="my-6 flex justify-center items-center w-fit rounded-4 overflow-hidden"> - {{ range .Site.Params.nav }} - <a class="inline-block py-1 px-[0.35rem] md:px-2 first:pl-3 last:pr-3 - block hover:no-underline text-nowrap - {{ if eq $.Page.RelPermalink .link }} - text-[var(--text-color)] bg-[var(--block-background-color)] - {{ else }} - text-[var(--background-color)] bg-[var(--text-color)] - {{ end }}" - href="{{ .link }}" - >{{ .name }}</a> - {{ end }} -</nav> diff --git a/layouts/_partials/header/other-navigation.html b/layouts/_partials/header/other-navigation.html deleted file mode 100644 index 4be0dba0..00000000 --- a/layouts/_partials/header/other-navigation.html +++ /dev/null @@ -1,29 +0,0 @@ -{{ $langButtonSize := "w-4 h-4" }} - -<div class="flex gap-2 pr-2"> - <!-- theme switch --> - <label for="theme-select" class="hidden">colorscheme</label> - <select id="theme-select" - class="bg-neutral/10 border-1 border-[var(--text-color)] border-solid rd text-[var(--text-color)] font-serif text-size-[0.5rem] font-extrabold"> - {{ $switches := slice "auto" "light" "dark" }} - {{ range $switches }} - <option value="{{ . }}">{{ T (printf "theme.%s" .) }}</option> - {{ end }} - </select> - <!-- language switch --> - {{- $lang := .Site.Language.Lang -}} - {{- $switch := dict - "en" (dict "url" "/zh/" "label" "ZH" "title" "查看中文博客") - "zh" (dict "url" "/en/" "label" "EN" "title" "View English Blog") -}} - {{- $entry := index $switch $lang -}} - <a - href="{{ $entry.url }}" - class="rd-full text-center hover:no-underline {{ $langButtonSize }} - bg-neutral/10 border-1 border-[var(--text-color)] border-solid - bg-[var(--block-background-color)] - flex items-center justify-center" - title="{{ $entry.title }}" - > - <span class="text-size-[0.5rem] font-extrabold">{{ $entry.label }}</span> - </a> -</div> diff --git a/layouts/_partials/home/home-nav-item.html b/layouts/_partials/home/home-nav-item.html deleted file mode 100644 index b9b70c0f..00000000 --- a/layouts/_partials/home/home-nav-item.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ $active := .active }} -{{ $link := .link }} -{{ $text := .text }} - -<a href="{{ .Site.LanguagePrefix }}{{ $link }}" - class="texl-base md:text-lg relative - hover:no-underline relative - {{ if $active }}font-extrabold{{ end }}" -> - {{ $text }} - {{ if $active }} - <div class="absolute left-0 right-0 text-center top-3" - style="view-transition-name: home-nav-item-emphasis;">·</div> - {{ end }} -</a> diff --git a/layouts/_partials/home/home-nav.html b/layouts/_partials/home/home-nav.html deleted file mode 100644 index ce66e563..00000000 --- a/layouts/_partials/home/home-nav.html +++ /dev/null @@ -1,11 +0,0 @@ -{{ if eq .Site.Language.Lang "zh" }} -<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 - "link" .link - "active" (eq .link $.Page.RelPermalink) - ) }} - {{ end }} -</nav> -{{ end }} diff --git a/layouts/_partials/home/latest-posts.html b/layouts/_partials/home/latest-posts.html deleted file mode 100644 index ac015111..00000000 --- a/layouts/_partials/home/latest-posts.html +++ /dev/null @@ -1,11 +0,0 @@ -<!-- Latest Posts --> -<section class="pagefind-exclude flex flex-col my-4"> - {{ $firstPost := true }} - {{ range first 12 (where site.RegularPages "Type" "in" site.Params.mainSections) }} - {{ partial "items/post" (dict - "ctx" . - "showSummary" $firstPost - ) }} - {{ $firstPost = false }} - {{ end }} -</section> diff --git a/layouts/_partials/home/microformats.html b/layouts/_partials/home/microformats.html deleted file mode 100644 index 8641b04c..00000000 --- a/layouts/_partials/home/microformats.html +++ /dev/null @@ -1,7 +0,0 @@ -<div class="hidden p-author h-card pt"> - <img class="u-photo icon" alt="{{ .Site.Params.author.name }}" - src="{{ printf "%s%s" .Site.Params.assetBaseUrl .Site.Params.author.avatar }}" /> - <a class="p-name u-url" rel="me" href="{{ .Site.BaseURL }}" - >{{ .Site.Params.author.name }}</a> - <a class="u-url" rel="me" href="https://www.eltr.ac/">Home</a> -</div> diff --git a/layouts/_partials/home/more-links.html b/layouts/_partials/home/more-links.html deleted file mode 100644 index 6201f642..00000000 --- a/layouts/_partials/home/more-links.html +++ /dev/null @@ -1,15 +0,0 @@ -<!-- more links: see archive & slash pages --> -<div class="flex justify-between items-center"> - <div> - <a class="small-button" href="{{ if eq .Site.Language.Lang "zh" }}/archive{{ else }}{{ .Site.LanguagePrefix }}/posts{{ end }}"> - {{ T "seeArchive" }} → - </a> - </div> - <ul class="list-none flex gap-1 md:gap-2 text-sm md:text-base ps-0 my-2 mx-0 md:justify-end"> - {{ range .Site.Params.internalLinks }} - <li><a href="{{ .link }}" title="{{ .name }}" - class="text-secondary">{{ .name }}</a></li> - <li class="text-secondary last:hidden">·</li> - {{ end }} - </ul> -</div> diff --git a/layouts/_partials/items/book.html b/layouts/_partials/items/book.html deleted file mode 100644 index 5b6e61c2..00000000 --- a/layouts/_partials/items/book.html +++ /dev/null @@ -1,36 +0,0 @@ -{{ $ctx := .ctx }} -{{ $NoViewTransition := (or .NoViewTransition false) }} - -<!-- Transform cover images via Cloudflare URL patterns --> -{{ $splitURL := split $ctx.Params.cover "/" }} -{{ $cover := "" }} -{{ $i := 0 }} -{{ range $splitURL }} - {{ if eq $i 3 }} - {{ $cover = printf "%s%s" $cover "cdn-cgi/image/width=150,quality=75/" }} - {{ end }} - {{ $cover = printf "%s%s/" $cover . }} - {{ $i = add $i 1 }} -{{ end }} -{{ $cover = strings.TrimSuffix "/" $cover }} - -<div{{ if eq .Params.rating 1 }} class="opacity-50 z-0"{{ end }} - {{ if not $NoViewTransition }}style="view-transition-name: book-{{ $ctx.File.UniqueID }}"{{ end }}> - <a href="{{ $ctx.Permalink }}" - {{ if not $NoViewTransition }}style="view-transition-name: book-{{ $ctx.Title }}"{{ end }} - class="border-3 border-solid rotate-3 shadow-md block - hover:rotate-0 hover:-translate-y-2 hover:scale-110 transition - - {{ if eq $ctx.Params.rating 1 }} relative - {{ else if eq $ctx.Params.rating 5 }} border-amber-300 shadow-amber-200 shadow-xl - {{ else }} border-white{{ end }}"> - <img class="lazy w-full block min-h-[120px] bg-neutral-500" src="{{ $cover }}" /> - {{ if eq $ctx.Params.rating 1 }} - <div class="absolute z-1 top-[25%] left-[25%] h-[50%] w-[50%]" - style="background-image: url('https://r2.eltr.ac/uPic/2025/05/thumbs-down.png'); - background-size: 100%; - background-position: center; - background-repeat: no-repeat;"></div> - {{ end }} - </a> -</div> diff --git a/layouts/_partials/items/card.html b/layouts/_partials/items/card.html deleted file mode 100644 index 01a3cfb8..00000000 --- a/layouts/_partials/items/card.html +++ /dev/null @@ -1,19 +0,0 @@ -{{ $ctx := .context }} -{{ $showSummary := .summary }} -{{ $summaryClass := .summaryClass }} -<div class="relative p-6 bg-white dark:bg-neutral-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-700" - style="view-transition-name: card-{{ $ctx.File.UniqueID }}"> - <div class="card-header"> - <h3 class="text-xl font-extrabold m-0 text-gray-900 dark:text-gray-100" - data-pagefind-meta="title" - data-pagefind-sort="date[data-date], weight[data-weight]" - data-date="{{ .Date.Format "2006-01-02" }}" - data-weight="5"> - <a href="{{ $ctx.RelPermalink }}" class="no-underline! text-[var(--text-color)]!">{{ $ctx.Title }}</a> - </h3> - <div class="text-base m-0">{{ partial "components/tags" $ctx }}</div> - </div> - <div class="{{ $summaryClass }} mt-2 leading-loose markdown-body"> - {{ if $showSummary }}{{ $ctx.Summary }}{{ else }}{{ $ctx.Content }}{{ end }} - </div> -</div> diff --git a/layouts/_partials/items/post-small.html b/layouts/_partials/items/post-small.html deleted file mode 100644 index 28a4a995..00000000 --- a/layouts/_partials/items/post-small.html +++ /dev/null @@ -1,11 +0,0 @@ -{{ $isWeekly := (eq .Params.categories "稻草人周刊") }} -<li class="flex justify-between text-size-lg - {{ if $isWeekly }} weekly animate-duration-500 transition-opacity{{ end }}"> - <a href="{{ .RelPermalink }}"> - {{ .Title }}{{ with .Params.subtitle }}:<span class="text-secondary">{{. }}</span> - {{ end }} - </a> - <time class="text-size-sm font-mono text-secondary flex-shrink-0"> - {{ .Date.Format "2006-1-2" }} - </time> -</li> diff --git a/layouts/_partials/items/post.html b/layouts/_partials/items/post.html deleted file mode 100644 index 5527ea6c..00000000 --- a/layouts/_partials/items/post.html +++ /dev/null @@ -1,41 +0,0 @@ -{{ $ctx := .ctx }} -{{ $showSummary := .showSummary }} -<div class="posts-item w-full my-2" - style="view-transition-name: post-{{ .ctx.File.UniqueID }}"> - <header class="w-full md:flex md:justify-between"> - <div> - <p class="font-mono text-secondary"> - <time>{{ .ctx.Date.Format "January 2" }},</time> - <span>in <a href="/{{ .ctx.Section }}/">{{ .ctx.Section }}</a></span> - </p> - <h2 class="xerox" - {{ if $showSummary }} style="margin-bottom: 0"{{ end }}> - <a href="{{ .ctx.Permalink }}"> - {{ if eq .ctx.Section "library" }} - 读《{{ .ctx.Title }}》 - {{ else }} - {{ .ctx.Title }} - {{ end }} - </a> - {{ if eq .ctx.Section "fictions" }} - <span class="font-normal text-4 text-secondary">小说</span> - {{ end }} - </h2> - </div> - {{ with .ctx.Params.categories }} - <div class="my-4"> - {{ partial "components/category-pill" $ctx }} - </div> - {{ end }} - </header> - {{ if or $showSummary .ctx.Params.description }} - <div class="markdown-body text-size-lg leading-relaxed" - style="view-transition-name: post-content-{{ .ctx.File.UniqueID }}"> - {{ if $showSummary }} - {{ .ctx.Summary }} - {{ else if .ctx.Params.description }} - {{ .ctx.Params.description }} - {{ end }} - </div> - {{ end }} -</div> diff --git a/layouts/_partials/posts/action-area.html b/layouts/_partials/posts/action-area.html deleted file mode 100644 index 06f0003d..00000000 --- a/layouts/_partials/posts/action-area.html +++ /dev/null @@ -1,16 +0,0 @@ -<div popover - id="action-area" - class="bg-white dark:bg-neutral-800 - border border-neutral-200 dark:border-neutral-600 - rd-md shadow-lg p-4 w-80"> - <div class="grid grid-cols-2 gap-4"> - {{ partial "posts/fediverse-form" . }} - {{ partial "posts/webmention-form" . }} - </div> - <div class="flex justify-between mt-2 items-center"> - <p class="text-sm text-secondary m-0"><a href="mailto:hi@eltr.ac?subject=Re%3A%20{{ .Title }}">📧 {{ T "actionMenu.email" }}</a></p> - {{ if eq .Site.Language.Lang "zh" }} - <p class="m-0 text-xs"><a class="text-secondary" href="/posts/site-report-4/#所以怎么点赞和评论你的博客">这是什么?</a></p> - {{ end }} - </div> -</div> diff --git a/layouts/_partials/posts/banner.html b/layouts/_partials/posts/banner.html deleted file mode 100644 index 6acaafdc..00000000 --- a/layouts/_partials/posts/banner.html +++ /dev/null @@ -1,9 +0,0 @@ -{{ $page := . }} -{{ with .Params.banner }} -<img - class="lazy w-full h-auto block rounded-lg{{ if $page.Params.bannerAutoInvert }} dark:invert{{ end }}" - loading="lazy" - data-pagefind-meta="image[src]" - src="{{ . }}" -> -{{ end }} diff --git a/layouts/_partials/posts/comment.html b/layouts/_partials/posts/comment.html deleted file mode 100644 index 90757781..00000000 --- a/layouts/_partials/posts/comment.html +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - Giscus has been abandoned since 2026-01-30, - old data from GitHub Discussion and some other comment systems - has been exported to `data/gicus.json` - They are rendered here if found. ---> -{{ $cutoffDate := time.AsTime "2026-01-30" }} -{{ if .Params.Date.Before $cutoffDate }} - {{ $giscusData := hugo.Data.giscus }} - {{ $pageTitle := .Title }} - {{ range $giscusData }} - {{ if eq .title $pageTitle }} - {{ $url := .url }} - {{ with .comments.nodes }} - <details> - <summary class="text-size-sm text-secondary cursor-pointer">博客的评论区已经被禁用,旧的数据已经导出,可以点击这行字查看。</summary> - <div class="my-4"> - {{ range . }} - <div class="text-md py-4 px-1"> - <div class="mb-4 flex justify-between"> - <span class="font-bold">{{ .author.login }}</span> - <span class="text-secondary">{{ .createdAt | time.Format "2006/01/02" }}</span> - </div> - <div> - {{ .body | markdownify }} - </div> - </div> - {{ end }} - </div> - {{ with $url }} - <p><a href="{{ . }}" class="small-button" target="_blank">Full GitHub Discussion →</a></p> - {{ end }} - <hr /> - </details> - {{ end }} - {{ end }} - {{ end }} -{{ end }} diff --git a/layouts/_partials/posts/endnotes.html b/layouts/_partials/posts/endnotes.html deleted file mode 100644 index 107ffd77..00000000 --- a/layouts/_partials/posts/endnotes.html +++ /dev/null @@ -1,13 +0,0 @@ -{{ if .Params.endnotes }} -<hr> -<div id="post-endnotes" class="text-secondary text-4"> - <ul class="list-none"> - {{ range .Params.endnotes }} - <li class="flex gap-4 pl-4"> - <span>→</span> - <span>{{ . | markdownify }}</span> - </li> - {{ end }} - </ul> -</div> -{{ end }} diff --git a/layouts/_partials/posts/fediverse-form.html b/layouts/_partials/posts/fediverse-form.html deleted file mode 100644 index faff355f..00000000 --- a/layouts/_partials/posts/fediverse-form.html +++ /dev/null @@ -1,14 +0,0 @@ -{{ if .Params.toot }} -<div class="flex flex-col gap-2"> - <h4 class="text-sm font-semibold m-0 dark:text-white">{{ T "actionMenu.fediverse" }}</h4> - <input type="text" id="fediverse-instance" placeholder="{{ T "actionMenu.fediversePlaceholder" }}" class="text-sm px-2 py-1 border border-neutral-300 dark:border-neutral-600 rounded bg-transparent dark:text-white"> - <div class="flex gap-2"> - <button id="fediform-copy-button" class="text-xs px-2 py-1 bg-neutral-100 dark:bg-neutral-700 rounded hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors">📋</button> - - <button id="fediform-button" class="w-full text-xs px-2 py-1 bg-neutral-200 dark:bg-neutral-600 rounded hover:bg-neutral-300 dark:hover:bg-neutral-500 transition-colors">{{ T "actionMenu.openToot" }}</button> - </div> -</div> -<script> - const tootUrl = '{{ .Params.toot }}' -</script> -{{ end }} diff --git a/layouts/_partials/posts/toc.html b/layouts/_partials/posts/toc.html deleted file mode 100644 index 0bc96782..00000000 --- a/layouts/_partials/posts/toc.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ $top := cond (eq .Section "posts") "top-[19rem]" (cond (eq .Section "library") "top-[34rem]" "top-[17rem]") }} -{{ if .Params.toc }} -<div id="toc-container" - class="absolute bottom-0 left-[calc(50%_+_var(--page-width)_/_2)] right-auto - h-full w-[calc(50%_-_var(--page-width)_/_2)] {{ $top }} hidden lg:block"> - <div id="toc" - class="sticky top-12 text-size-xs xl:text-size-sm 2xl:text-size-base w-full" - >{{ .TableOfContents }}</div> -</div> -{{ end }} diff --git a/layouts/_partials/posts/webmention-form.html b/layouts/_partials/posts/webmention-form.html deleted file mode 100644 index 4499f89b..00000000 --- a/layouts/_partials/posts/webmention-form.html +++ /dev/null @@ -1,6 +0,0 @@ -<form action="https://wm.geedea.pro/endpoint" method="POST" class="flex flex-col gap-2"> - <h4 class="text-sm font-semibold m-0 dark:text-white">{{ T "actionMenu.webmention" }}</h4> - <input type="url" name="source" placeholder="{{ T "actionMenu.webmentionPlaceholder" }}" class="text-sm px-2 py-1 border border-neutral-300 dark:border-neutral-600 rounded bg-transparent dark:text-white"> - <input type="hidden" name="target" value="{{ .Permalink }}"> - <button type="submit" class="text-xs px-2 py-1 bg-neutral-200 dark:bg-neutral-600 rounded hover:bg-neutral-300 dark:hover:bg-neutral-500 transition-colors">{{ T "actionMenu.send" }}</button> -</form> diff --git a/layouts/_partials/posts/webmention-mentions.html b/layouts/_partials/posts/webmention-mentions.html deleted file mode 100644 index e4744bf7..00000000 --- a/layouts/_partials/posts/webmention-mentions.html +++ /dev/null @@ -1,56 +0,0 @@ -{{ with . }} -<section class="my-4"> -<ul class="list-none p-0 m-0"> -{{ range . }} - {{ if index . "microformats" }} - {{ $mf := index . "microformats" "properties" }} - {{ $author := dict }} - {{ if $mf.author }} - {{ if reflect.IsSlice $mf.author }} - {{ $authorElem := index $mf.author 0 }} - {{ if reflect.IsMap $authorElem }} - {{ $author = index $authorElem "properties" }} - {{ else }} - {{ $author = $authorElem }} - {{ end }} - {{ else }} - {{ $author = $mf.author }} - {{ end }} - {{ end }} - {{ if eq (index .microformats.type 0) "h-card" }} - {{ $author = $mf }} - {{ end }} - {{ $photo := "" }} - {{ $authorName := "" }} - {{ $authorUrl := "" }} - - {{ if reflect.IsMap $author }} - {{ $photo = or (index . "extra" "proxied-photo") (index $author.photo 0) }} - {{ $authorName = index $author.name 0 }} - {{ $authorUrl = index $author.url 0 }} - {{ else }} - {{ $photo = index . "extra" "proxied-photo" }} - {{ $authorName = $author }} - {{ $authorUrl = .webmention.source }} - {{ end }} - - <li class="flex gap-2"> - {{ if $photo }} - <img src="{{ $photo }}" class="h-5 w-5 rd-full inline m-0"> - {{ else }} - <div class="h-5 w-5 rd-full m-0 bg-neutral-300"></div> - {{ end }} - <a href="{{ $authorUrl }}" target="_blank">{{ $authorName }}</a> - <a href="{{ .webmention.source }}" target="_blank">{{ T "webmention.mentionedThisPost" . }}</a> - </li> - {{ else }} - <li class="flex gap-2"> - {{ $u := urls.Parse .webmention.source }} - <div class="h-5 w-5 rd-full m-0 bg-neutral-300"></div> - <span>{{ $u.Hostname }}</span> - <a href="{{ .webmention.source }}" target="_blank">{{ T "webmention.mentionedThisPost" . }}</a></li> - {{ end }} -{{ end }} -</ul> -</section> -{{ end }} diff --git a/layouts/_partials/posts/webmention-replies.html b/layouts/_partials/posts/webmention-replies.html deleted file mode 100644 index 66b64ef9..00000000 --- a/layouts/_partials/posts/webmention-replies.html +++ /dev/null @@ -1,69 +0,0 @@ -{{ with . }} -<section class="flex flex-col gap-4 bg-[var(--background-color)]"> -{{ range . }} - {{ $reply := index . "microformats" "properties" }} - {{ $author := dict }} - {{ $photo := "" }} - - {{ if $reply.author }} - {{ if reflect.IsSlice $reply.author }} - {{ $authorElem := index $reply.author 0 }} - {{ if reflect.IsMap $authorElem }} - {{ $author = index $authorElem "properties" }} - {{ else }} - {{ $author = $authorElem }} - {{ end }} - {{ $photo = or (index $author.photo 0) (index $reply.photo 0) }} - {{ else }} - {{ $author = $reply.author }} - {{ $photo = index $reply.photo 0 }} - {{ end }} - {{ end }} - -<div class="relative"> - <header class="flex justify-between items-start"> - <div class="flex items-center gap-3"> - <img src="{{ $photo }}" alt="Profile Picture" - class="h-8 w-8 rd-full" loading="lazy" /> - <div class="text-secondary"> - <p class="font-bold m-0"> - <a href="{{ if reflect.IsMap $author }} - {{ or (index $author.url 0) (index $reply.url 0) }} - {{ else }} - {{ index $reply.url 0 }} - {{ end }}"> - {{ if reflect.IsMap $author }} - {{ replaceRE ":.*?:" "" (index $author.name 0) }} - {{ else }} - {{ $author }} - {{ end }} - </a> - </p> - {{ $time := (index $reply.published 0) }} - {{ $isFormated := strings.Contains $time " " }} - {{ if not $isFormated }} - {{ $t := time.AsTime $time }} - {{ $time = time.Format "2006-1-2 15:04" $t }} - {{ end }} - <p class="m-0"><time>{{ $time }}</time></p> - </div> - </div> - <div class="flex items-start"> - <a href="{{ .webmention.source }}" target="_blank" - title="{{ T "viewExternalSource" }}" - data-tooltip>↗</a> - </div> - </header> - - <div class="max-h-[500px] overflow-y-auto overflow-x-hidden"> - <div class="webmention-body markdown-body leading-relaxed ml-3 pl-4 pr-2 b-l-4 b-l-solid b-neutral-200/50 dark:b-neutral-700/50"> - {{ index (index $reply.content 0) "html" | safeHTML }} - {{ if strings.Contains .webmention.source "https://brid.gy" }} - <p class="text-xs text-right text-secondary">通过 <a href="https://brid.gy/" target="_blank">Bridgy</a> 发送自联邦宇宙</p> - {{ end }} - </div> - </div> -</div> -{{ end }} -</section> -{{ end }} diff --git a/layouts/_partials/posts/webmention-summary.html b/layouts/_partials/posts/webmention-summary.html deleted file mode 100644 index 18be7344..00000000 --- a/layouts/_partials/posts/webmention-summary.html +++ /dev/null @@ -1,54 +0,0 @@ -{{ $likes := .likes }} -{{ $page := .page }} -{{ $othercount := .othercount }} - -<section class="group relative mb-6 vertical-middle"> - <!-- Action Area Toggle --> - <button - popovertarget="action-area" - data-tooltip - title="{{ T "actionMenu.interact" }}" - class="m-0 p-0 bg-transparent hover:no-underline cursor-pointer float-left mr-2"> - <div class="w-5 h-5 bg-neutral-200 dark:bg-neutral-600 flex justify-center items-center rd-full font-800">+</div> - </button> - - <!-- Likes --> - {{ range $likes }} - {{ $authors := index . "microformats" "properties" "author" }} - {{ $author := dict }} - {{ $photo := "" }} - {{ if $authors }} - {{ if reflect.IsSlice $authors }} - {{ $authorElem := index $authors 0 }} - {{ if reflect.IsMap $authorElem }} - {{ $author = index $authorElem "properties" }} - {{ else }} - {{ $author = $authorElem }} - {{ end }} - {{ else }} - {{ $author = $authors }} - {{ end }} - {{ end }} - {{ $photo = or (index . "extra" "proxied-photo") (index $author.photo 0) }} - <a href="{{ if reflect.IsMap $author }}{{ index $author.url 0 }}{{ else }}#{{ end }}" target="_blank" title="{{ if reflect.IsMap $author }}{{ index $author.name 0 }}{{ else }}{{ $author }}{{ end }}" class="box-border hover:no-underline inline-block h-5 w-5 float-left -ml-1 hover:scale-150 transition-transform"> - {{ $value := math.Floor (mul math.Rand 80) }} - {{ $rotate := cond (lt $value 40) (sub 10 $value) (sub $value 30) }} - {{ if $photo }} - <img src="{{ $photo }}" alt="Profile Picture" - loading="lazy" - class="h-5 w-5 rd-full transition-transform" - style="{{ if ne $rotate 0 }}--rotate-amount: {{ $rotate }}deg;{{ end }}" /> - {{ else }} - <div class="h-5 w-5 rd-full bg-neutral-300"></div> - {{ end }} - </a> - {{ end }} - <div class="text-secondary m-0 text-sm inline ml-2"> - {{ printf (T "webmention.likedBy") (len $likes ) }} - {{ if gt $othercount 0 }} - {{ printf (T "webmention.repliedAndMentionedBy") $othercount }} - {{ end }} - </div> - <div class="clear-left"></div> -</section> - diff --git a/layouts/_partials/posts/webmention.html b/layouts/_partials/posts/webmention.html deleted file mode 100644 index 77b89f25..00000000 --- a/layouts/_partials/posts/webmention.html +++ /dev/null @@ -1,73 +0,0 @@ -{{ $page := . }} -{{ $currentPagePath := .RelPermalink }} -{{ $webmentions_url := .Site.Params.webmention.src }} - -{{ with try (resources.GetRemote $webmentions_url) }} - {{ with .Err }} - {{ errorf "%s" . }} - - {{ else with .Value }} - {{ $webmentions := slice }} - {{ $data := . | transform.Unmarshal }} - - {{ range $data }} - {{ $urlObj := urls.Parse .webmention.target }} - {{ $targetPath := $urlObj.Path }} - - {{ if or (strings.Contains $targetPath $currentPagePath) - (strings.Contains $targetPath ($currentPagePath | urlquery)) }} - {{ $webmentions = $webmentions | append . }} - {{ end }} - {{ end }} - - {{ $likes := slice }} - {{ $replies := slice }} - {{ $reposts := slice }} - {{ $mentions := slice }} - - {{ range $webmentions }} - {{ $props := index . "microformats" "properties" }} - {{ $type := index . "microformats" "type" 0 }} - - {{ if eq $type "h-entry" }} - {{ if index $props "like-of" }} - {{ $likes = $likes | append . }} - - - {{ else if index $props "repost-of" }} - {{ $reposts = $mentions | append . }} - - {{ else }} - {{ $replies = $replies | append . }} - - {{ end }} - {{ else }} - {{ $mentions = $mentions | append . }} - {{ end }} - - {{ end }} - - {{ partial "posts/action-area" $page }} - <details class="my-4 mb-5 no-mark"> - <summary class="cursor-pointer flex"> - {{ partial "posts/webmention-summary" (dict - "likes" $likes - "page" $page - "othercount" (add (len $replies) (len $mentions)) - ) }} - </summary> - {{ with $page.Params.toot }} - <p class="text-secondary text-sm"> - {{ $link := printf "<a href=\"%s\" target=\"_blank\">Eucalyptus</a>" . }} - *{{ printf (T "webmention.bridgyNotice") $link | safeHTML }} - </p> - {{ end }} - <div id="webmention-details"> - {{ partial "posts/webmention-replies" $replies }} - {{ partial "posts/webmention-mentions" $mentions }} - </div> - </details> - {{ else }} - <p>Unable to fetch webmentions. Please contact webmaster.</p> - {{ end }} -{{ end }} diff --git a/layouts/_partials/scripts.html b/layouts/_partials/scripts.html deleted file mode 100644 index 5d782dd7..00000000 --- a/layouts/_partials/scripts.html +++ /dev/null @@ -1,43 +0,0 @@ -<!-- Theme Switch --> -<script> -document.addEventListener("DOMContentLoaded", () => { - const themeSelect = document.getElementById('theme-select') - themeSelect.value = localStorage.getItem('geedeapro.theme') - themeSelect.onchange = () => switchTheme(themeSelect.value, true) -}) -</script> - -<!-- global JS --> -{{ $commonJS := slice - (resources.Get "js/tooltip.js") - (resources.Get "js/instantpage.min.js") -}} -{{ $commonBundle := $commonJS | resources.Concat "js/common-bundle.js" | minify | fingerprint }} -<script src="{{ $commonBundle.RelPermalink }}" integrity="{{ $commonBundle.Data.Integrity }}" defer></script> - -<!-- content page only JS --> -{{ if not .IsHome }} - {{ $articleJS := slice - (resources.Get "js/toc.js") - (resources.Get "js/back2top.js") - (resources.Get "js/fediform.js") - }} - {{ $articleBundle := $articleJS | resources.Concat "js/article-bundle.js" | minify | fingerprint }} - <script src="{{ $articleBundle.RelPermalink }}" integrity="{{ $articleBundle.Data.Integrity }}" defer></script> -{{ end }} - -<!-- libra.js --> -<script type="module"> -document.addEventListener('DOMContentLoaded', async () => { - const { default: LightBox } = await import('/js/libra.min.js'); - const lightbox = new LightBox({ - offset: { x: -8, y: -48 }, - selector: "[data-libra]:not(.disable-libra *)", - }); -}); -</script> - -<!-- GoatCounter --> -<script data-goatcounter="https://stats.geedea.pro/count" - async src="//stats.geedea.pro/count.js"></script> - diff --git a/layouts/_partials/stats/external-link-rank.html b/layouts/_partials/stats/external-link-rank.html deleted file mode 100644 index 4268d4d9..00000000 --- a/layouts/_partials/stats/external-link-rank.html +++ /dev/null @@ -1,37 +0,0 @@ -{{/* Find the maximum link count */}} -{{ $max := 0 }} -{{ range hugo.Data.externallinks }} - {{ if gt (index . 1) $max }} - {{ $max = index . 1 }} - {{ end }} -{{ end }} - -{{/* Sort by count (descending) */}} -{{ $links := hugo.Data.externallinks }} -{{ $sorted := slice }} -{{ range $links }} - {{ $sorted = $sorted | append (dict "domain" (index . 0) "count" (index . 1)) }} -{{ end }} -{{ $sorted = sort $sorted "count" "desc" }} - -<ol id="external-link-rank" - class="p-0! m-0 box-border"> -{{ range $sorted }} - {{ $label := .domain }} - {{ $count := .count }} - {{ if gt $count 4 }} - {{ $percent := div (mul $count 100) $max }} - <li class="list-none w-full my-2 box-border py-[0.1rem] px-2 relative"> - <div class="mx-2 flex justify-between items-center"> - <a class="inline-flex items-center gap-2 no-icon" href="https://{{ $label }}/" target="_blank"> - <img src="https://favicone.com/{{ $label }}?s=20" - class="w-4 h-4 m-0!" loading="lazy" /> - {{ $label }} - </a> - <span class="text-secondary font-mono">{{ $count }}</span> - </div> - <div class="bg-gray-200 dark:bg-zinc-700 absolute top-0 left-0 right-0 bottom-0 -z-1" style="width:{{ $percent }}%"></div> - </li> - {{ end }} -{{ end }} -</ol> diff --git a/layouts/_partials/stats/publish-time-chart.html b/layouts/_partials/stats/publish-time-chart.html deleted file mode 100644 index 3fa35078..00000000 --- a/layouts/_partials/stats/publish-time-chart.html +++ /dev/null @@ -1,78 +0,0 @@ -{{/* 定义时间段 */}} -{{ $fuzzyTimes := slice - (dict "limit" 5 "label" "凌晨" "class" "dawn") - (dict "limit" 11 "label" "早上" "class" "morning") - (dict "limit" 13 "label" "中午" "class" "noon") - (dict "limit" 17 "label" "下午" "class" "afternoon") - (dict "limit" 22 "label" "晚上" "class" "night") - (dict "limit" 24 "label" "深夜" "class" "late-night") -}} - -{{/* 初始化时间段计数 */}} -{{ $timeCounts := dict - "凌晨" 0 - "清晨" 0 - "早上" 0 - "中午" 0 - "下午" 0 - "傍晚" 0 - "晚上" 0 - "深夜" 0 -}} - -{{/* 统计每个时间段的文章数量 */}} -{{ $total := 0 }} -{{ range .Site.RegularPages }} - {{ if .Date }} - {{ $hour := .Date.Hour }} - {{ $fuzzyTime := "深夜" }} - {{ range $fuzzyTimes }} - {{ if lt $hour .limit }} - {{ $fuzzyTime = .label }} - {{ break }} - {{ end }} - {{ end }} - {{ $total = add $total 1 }} - {{ $currentCount := index $timeCounts $fuzzyTime }} - {{ $timeCounts = merge $timeCounts (dict $fuzzyTime (add $currentCount 1)) }} - {{ end }} -{{ end }} - -<div class="w-full max-w-[700px] my-4"> - <div class="flex items-center gap-4 mb-4"> - <div class="text-size-2xl flex-shrink-0">☀️</div> - <div class="flex gap-2 w-full h-6 dark:invert"> - {{ range $fuzzyTimes }} - {{ $count := index $timeCounts .label }} - {{ if gt $total 0 }} - {{ $percentage := div (mul $count 100.0) $total }} - {{ if gt $count 0 }} - <div class="flex items-center justify-center - text-white rounded-2xl text-size-sm font-500 relative - bg-black opacity-{{ add (mul (int (div $percentage 10)) 10) 30 }} - {{ .class }}" - style="width: {{ printf "%.1f" $percentage }}%;" - title="{{ .label }}: {{ $count }}篇 ({{ printf "%.1f" $percentage }}%)"> - {{ if gt $percentage 8 }}{{ .label }}{{ end }} - </div> - {{ end }} - {{ end }} - {{ end }} - </div> - <div class="text-size-2xl flex-shrink-0">🌙</div> - </div> - - <div class="flex gap-2 mt-2 px-10"> - {{ range $fuzzyTimes }} - {{ $count := index $timeCounts .label }} - {{ if gt $count 0 }} - {{ $percentage := div (mul $count 100.0) $total }} - <div class="flex flex-col items-center text-size-xs - text-secondary font-mono" - style="width: {{ printf "%.1f" $percentage }}%;"> - <span class="font-600 text-[var(--primary-text-color)]">{{ $count }}</span> - </div> - {{ end }} - {{ end }} - </div> -</div> diff --git a/layouts/_partials/stats/stats-table.html b/layouts/_partials/stats/stats-table.html deleted file mode 100644 index bb936721..00000000 --- a/layouts/_partials/stats/stats-table.html +++ /dev/null @@ -1,44 +0,0 @@ -<style> -.site-stats-table td { - padding: 0.5rem; - text-align: left; -} -.site-stats-table td:nth-child(2n) { - text-align: right; -} -.number-pill { - text-align: center; - display: inline-block; - line-height: 1.75rem; - box-sizing: border-box; - border-radius: 5px; - padding: 0 0.5rem; - background-color: var(--block-background-color); - font-size: 1rem; -} -</style> - -<table class="site-stats-table w-full max-w-[700px] border-collapse mb-6"> - <tbody> - <tr> - <td>页面总数</td> - <td><span class="number-pill">{{ len .Site.RegularPages }}</span></td> - <td>总字数</td> - <td> - <span class="number-pill"> - {{- $words := 0 -}} - {{- range (where .Site.RegularPages "Section" "!=" "") -}} - {{- $words = add $words .WordCount -}} - {{- end -}} - {{ lang.FormatNumber 0 $words }} - </span> - </td> - </tr> - <tr> - <td>标签总数</td> - <td><span class="number-pill">{{ len .Site.Taxonomies.tags }}</span></td> - <td>文章系列数量</td> - <td><span class="number-pill">{{ len .Site.Taxonomies.categories }}</span></td> - </tr> - </tbody> -</table> diff --git a/layouts/_partials/stats/word-count-chart.html b/layouts/_partials/stats/word-count-chart.html deleted file mode 100644 index 835ecbda..00000000 --- a/layouts/_partials/stats/word-count-chart.html +++ /dev/null @@ -1,46 +0,0 @@ -{{/* Group word counts per month */}} -{{ $monthly := dict }} -{{ range .Site.RegularPages }} - {{ $month := .Date.Format "2006-01" }} - {{ $count := .WordCount }} - {{ with index $monthly $month }} - {{ $monthly = merge $monthly (dict $month (add . $count)) }} - {{ else }} - {{ $monthly = merge $monthly (dict $month $count) }} - {{ end }} -{{ end }} - -{{/* Sort months */}} -{{ $months := slice }} -{{ range $month, $_ := $monthly }} - {{ $months = $months | append $month }} -{{ end }} -{{ $months = sort $months }} - -{{/* Find max value */}} -{{ $max := 0 }} -{{ range $month := $months }} - {{ $val := index $monthly $month }} - {{ if gt $val $max }}{{ $max = $val }}{{ end }} -{{ end }} - -<div class="flex items-end justify-end h-[300px] gap-2 px-4 - text-size-xs w-full overflow-x-auto box-border"> - {{ range $month := $months }} - {{ $val := index $monthly $month }} - {{ $height := mul (div (float $val) (float $max)) 100 }} - {{ $opacity := add 0.5 (div $height 200) }} - <div class="flex flex-col justify-center"> - <div class="flex flex-col items-center justify-end - w-4 gap-1 h-[200px] relative"> - <div class="text-size-[0.65rem]" - style="writing-mode: vertical-rl;">{{ $val }}</div> - <div class="w-full bg-gray-900 flex-shrink-0 transition dark:invert" - style="height: {{ printf "%.1f" $height }}%; - background-color: rgba(20,20,20,{{ printf "%.2f" $opacity }});"></div> - </div> - <div class="h-12 text-center flex-shrink" - style="writing-mode: vertical-rl;">{{ $month }}</div> - </div> - {{ end }} -</div> diff --git a/layouts/_partials/taxonomy/all-categories.html b/layouts/_partials/taxonomy/all-categories.html deleted file mode 100644 index 7cb5813a..00000000 --- a/layouts/_partials/taxonomy/all-categories.html +++ /dev/null @@ -1,33 +0,0 @@ -<p class="text-sm text-secondary">* 表示常驻系列,其他系列可能会在完成后停止更新<p> -<!-- Display Categories --> -<div class="md:relative outbox md:h-[20rem] md:w-full"> -<section class="md:overflow-x-auto md:absolute md:left-0 md:right-0"> - <div class="flex flex-wrap justify-between md:flex-nowrap md:gap-6"> - <hr /> - {{ range sort (sort .Site.Taxonomies.categories ".Count" "desc") ".Page.Params.pinned" "desc" }} - {{ if not .Page.Params.archive }} - <a href="{{ .Page.RelPermalink }}" - class="block hover:no-underline hover:-transform-translate-y-2 transition-transform - md:writing-vertical" - style="view-transition-name: category-{{ .Page.Title }};"> - <div> - <h3 class="mx-2 xerox"> - 《{{ .Page.LinkTitle }}》 - {{ if .Page.Params.pinned }}*{{ end }} - </h3> - <p class="m-0 text-secondary mt-4">{{ .Page.Params.description | markdownify }}</p> - </div> - </a> - <hr /> - {{ end }} - {{ end }} - </div> -</section> -</div> - - -<p class="mt-4"> - <a class="small-button" href="/categories/uncategorized/"> - 查看随笔 <span class="text-secondary">→</span> - </a> -</p> diff --git a/layouts/_partials/taxonomy/all-tags.html b/layouts/_partials/taxonomy/all-tags.html deleted file mode 100644 index efd63fb4..00000000 --- a/layouts/_partials/taxonomy/all-tags.html +++ /dev/null @@ -1,46 +0,0 @@ -<!-- Display Tags --> -<section> - {{ $categorizedTags := dict }} - {{ $uncategorizedTags := slice }} - - <!-- Group tags by category --> - {{ range $tagName, $tagPages := .Site.Taxonomies.tags }} - {{ $tagPage := site.GetPage (printf "/tags/%s" $tagName) }} - {{ $tagData := dict "Name" $tagName "Count" (len $tagPages) "Page" $tagPage }} - {{ if $tagPage.Params.category }} - {{ $category := $tagPage.Params.category }} - {{ $categoryTags := index $categorizedTags $category | default slice }} - {{ $categoryTags = $categoryTags | append $tagData }} - {{ $categorizedTags = merge $categorizedTags (dict $category $categoryTags) }} - {{ else }} - {{ $uncategorizedTags = $uncategorizedTags | append $tagData }} - {{ end }} - {{ end }} - - <!-- Sort tags by count --> - {{ $uncategorizedTags = sort $uncategorizedTags "Count" "desc" }} - {{ range $category, $categoryTags := $categorizedTags }} - {{ $categorizedTags = merge $categorizedTags (dict $category (sort $categoryTags "Count" "desc")) }} - {{ end }} - - <!-- Display uncategorized tags first --> - {{ if $uncategorizedTags }} - <div class="flex flex-wrap gap-2"> - {{ range $uncategorizedTags }} - {{ partial "taxonomy/tag-pill" . }} - {{ end }} - </div> - {{ end }} - - <!-- Display categorized tags --> - {{ range $category, $categoryTags := $categorizedTags }} - <div> - <h3>{{ $category }}</h3> - <div class="flex flex-wrap gap-2"> - {{ range $categoryTags }} - {{ partial "taxonomy/tag-pill" . }} - {{ end }} - </div> - </div> - {{ end }} -</section> diff --git a/layouts/_partials/taxonomy/archived-categories.html b/layouts/_partials/taxonomy/archived-categories.html deleted file mode 100644 index 26ed68d8..00000000 --- a/layouts/_partials/taxonomy/archived-categories.html +++ /dev/null @@ -1,16 +0,0 @@ -<ul class="list-none p-0"> - {{ range .Site.Taxonomies.categories }} - {{ if .Page.Params.archive }} - <li class="flex justify-between items-center gap-4"> - <a class="flex-shrink-0" href="{{ .Page.RelPermalink }}"> - <h3 class="xerox">《{{ .Page.LinkTitle }}》</h3> - </a> - <div class="w-full"><hr class="m-0" /></div> - <span class="text-secondary font-mono flex-shrink-0"> - {{ T "archivePage.postCountMonthly" (len .Pages) }} - </span> - </li> - {{ end }} - {{ end }} -</ul> - diff --git a/layouts/_partials/taxonomy/pagefind.html b/layouts/_partials/taxonomy/pagefind.html deleted file mode 100644 index 2c41457d..00000000 --- a/layouts/_partials/taxonomy/pagefind.html +++ /dev/null @@ -1,7 +0,0 @@ -<div id="pagefind" class="py-3"></div> -<script src="/pagefind/pagefind-ui.js"></script> -<script> - window.addEventListener('DOMContentLoaded', () => { - new PagefindUI({ element: "#pagefind", showSubResults: true }); - }); -</script> diff --git a/layouts/_partials/taxonomy/tag-pill.html b/layouts/_partials/taxonomy/tag-pill.html deleted file mode 100644 index ad13c62e..00000000 --- a/layouts/_partials/taxonomy/tag-pill.html +++ /dev/null @@ -1,24 +0,0 @@ -<a href="{{ .Page.RelPermalink }}" - class="inline-flex items-center gap-2 text-size-sm px-2 py-1 - transition-colors duration-300 rounded-md hover:no-underline - - {{ if lt .Count 4 }} - bg-none border border-dashed border-[var(--border-color)] text-[var(--secondary-text-color)] - hover:text-inherit hover:border-solid - {{ else }} - bg-[var(--block-background-color)] - hover:bg-[var(--text-color)] hover:text-[var(--block-background-color)] - {{ end }}"> - {{ if .Page.Params.icon }} - {{ if or (hasPrefix .Page.Params.icon "http://") (hasPrefix .Page.Params.icon "https://") }} - <span class="inline-flex items-center"> - <img src="{{ .Page.Params.icon }}" alt="{{ .Page.LinkTitle }}" - style="height:1em;width:1em"> - </span> - {{ else }} - <span class="inline-flex items-center">{{ .Page.Params.icon }}</span> - {{ end }} - {{ end }} - <span>{{ if not .Page.Params.icon }}#{{ end }}{{ .Page.LinkTitle }}</span> - <span class="text-size-xs text-[var(--secondary-text-color)]">{{ .Count }}</span> -</a> diff --git a/layouts/_partials/template/post-page.html b/layouts/_partials/template/post-page.html deleted file mode 100644 index 0b55d48a..00000000 --- a/layouts/_partials/template/post-page.html +++ /dev/null @@ -1,45 +0,0 @@ -<article class="h-entry"> - <!-- 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] z-10" - "imageClass" "block w-full" - "ctx" . - ) }} - {{ else }} - {{ partial "components/logo" (dict - "class" "block w-[10rem]" - "imageClass" "block w-full" - "ctx" . - ) }} - {{ end }} - - {{ partial "posts/banner" . }} - <!-- Title and Subtitle --> - <h1 class="text-size-3xl font-900 xerox"> - <span data-pagefind-meta="title" class="p-name">{{ .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> - - {{ partial "content" . }} - {{ partial "posts/webmention" . }} - <!-- kept for legacy pages --> - {{ partial "posts/comment" . }} - - {{ partial "components/back-to-top" . }} - {{ partial "components/microformats" . }} -</article> diff --git a/layouts/_partials/term/term-books.html b/layouts/_partials/term/term-books.html deleted file mode 100644 index 2bd48295..00000000 --- a/layouts/_partials/term/term-books.html +++ /dev/null @@ -1,9 +0,0 @@ -{{ $books := where .Pages "Section" "eq" "library" }} -{{ if gt (len $books) 0 }} -<h2>{{ T "termPage.books" }}</h2> -<div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4"> - {{ range $books }} - {{ partial "items/book" (dict "ctx" .) }} - {{ end }} -</div> -{{ end }} diff --git a/layouts/_partials/term/term-fictions.html b/layouts/_partials/term/term-fictions.html deleted file mode 100644 index 3e3fd4a9..00000000 --- a/layouts/_partials/term/term-fictions.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ $fictions := where .Pages "Section" "fiction" }} -{{ if gt (len $fictions) 0 }} -<h2>{{ T "termPage.fictions" }}</h2> -<ul id="term-fictions" - class="animate-duration-100 ps-0 flex flex-col gap-2 list-none leading-relaxed"> - {{ range $fictions }} - {{ partial "items/post-small" . }} - {{ end }} -</ul> -{{ end }} diff --git a/layouts/_partials/term/term-posts.html b/layouts/_partials/term/term-posts.html deleted file mode 100644 index e9f8136f..00000000 --- a/layouts/_partials/term/term-posts.html +++ /dev/null @@ -1,6 +0,0 @@ -<ul id="term-posts" - class="animate-duration-100 ps-0 flex flex-col gap-2 list-none leading-relaxed"> - {{ range where .Pages "Section" "article" }} - {{ partial "items/post-small" . }} - {{ end }} -</ul> diff --git a/layouts/_partials/term/term-weeklies.html b/layouts/_partials/term/term-weeklies.html deleted file mode 100644 index 56697b60..00000000 --- a/layouts/_partials/term/term-weeklies.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ $weeklies := where .Pages "Section" "weekly" }} -{{ if gt (len $weeklies) 0 }} -<h2>{{ T "termPage.weeklies" }}</h2> -<ul id="term-weeklies" - class="animate-duration-100 ps-0 flex flex-col gap-2 list-none leading-relaxed"> - {{ range $weeklies }} - {{ partial "items/post-small" . }} - {{ end }} -</ul> -{{ end }} diff --git a/layouts/_partials/utils/inject-footnotes.html b/layouts/_partials/utils/inject-footnotes.html deleted file mode 100644 index 31fdae82..00000000 --- a/layouts/_partials/utils/inject-footnotes.html +++ /dev/null @@ -1,70 +0,0 @@ -{{ $content := . }} - -{{ $footnotesPattern := `(?s)<div class="footnotes"[^>]*>.*?</div>` }} -{{ $footnotesMatch := findRE $footnotesPattern $content 1 }} - -{{ if $footnotesMatch }} - {{ $footnotesSection := index $footnotesMatch 0 }} - - {{ $liPattern := `(?s)<li id="fn:(\d+)">(.*?)</li>` }} - {{ $footnoteItems := findRESubmatch $liPattern $footnotesSection }} - - {{ $footnoteMap := dict }} - {{ range $footnoteItems }} - {{ $id := index . 1 }} - {{ $contentRaw := index . 2 }} - {{ $cleanContent := replaceRE `(?s)\s*<a href="#fnref:\d+"[^>]*>.*?</a>\s*$` "" $contentRaw }} - {{ $footnoteMap = merge $footnoteMap (dict $id $cleanContent) }} - {{ end }} - - {{ $contentWithoutFootnotes := replaceRE $footnotesPattern "" $content }} - - {{ $refPattern := `<sup id="fnref:(\d+)".*?</sup>` }} - {{ $refs := findRESubmatch $refPattern $contentWithoutFootnotes }} - - {{ $result := $contentWithoutFootnotes }} - {{ $count := len $refs }} - - {{ range seq (sub $count 1) -1 0 }} - {{ $ref := index $refs . }} - {{ $refFull := index $ref 0 }} - {{ $refId := index $ref 1 }} - {{ $noteContent := index $footnoteMap $refId }} - - {{ if $noteContent }} - {{ $inlineFootnote := printf `<div class="inline-footnote text-xs text-secondary flex gap-2 ml-2 my-1 opacity-50 hover:opacity-100 transition-opacity" id="fn:%s"><span>%s.</span><div>%s</div></div>` $refId $refId $noteContent }} - - {{ $blockTags := slice "p" "li" "td" "th" "blockquote" "h1" "h2" "h3" "h4" "h5" "h6" "figcaption" "dt" "dd" }} - - {{ $found := false }} - - {{ range $blockTags }} - {{ if not $found }} - {{ $tag := . }} - {{ $pattern := printf `(?s)<%s[^>]*>.*?</%s>` $tag $tag }} - {{ $matches := findRE $pattern $result }} - - {{ range $matches }} - {{ if not $found }} - {{ $block := . }} - {{ if strings.Contains $block $refFull }} - {{ $newBlock := printf `%s%s` $block $inlineFootnote }} - {{ $result = replace $result $block $newBlock 1 }} - {{ $found = true }} - {{ end }} - {{ end }} - {{ end }} - {{ end }} - {{ end }} - - {{ if not $found }} - {{ $replacement := printf `%s%s` $refFull $inlineFootnote }} - {{ $result = replace $result $refFull $replacement 1 }} - {{ end }} - {{ end }} - {{ end }} - - {{ $content = $result }} -{{ end }} - -{{ $content | safeHTML }} diff --git a/layouts/_partials/utils/render.html b/layouts/_partials/utils/render.html deleted file mode 100644 index bdc4bf2f..00000000 --- a/layouts/_partials/utils/render.html +++ /dev/null @@ -1 +0,0 @@ -{{ partial "utils/inject-footnotes" . }} |
