diff options
| -rw-r--r-- | content/fiction/the-headless-angel.md | 1 | ||||
| -rw-r--r-- | i18n/zh.toml | 3 | ||||
| -rw-r--r-- | layouts/_partials/term/term-fictions.html | 10 | ||||
| -rw-r--r-- | layouts/_partials/term/term-header.html | 20 | ||||
| -rw-r--r-- | layouts/_partials/term/term-posts.html | 2 | ||||
| -rw-r--r-- | layouts/_partials/term/term-scripts.html | 73 | ||||
| -rw-r--r-- | layouts/_partials/term/term-weeklies.html | 10 | ||||
| -rw-r--r-- | layouts/term.html | 4 |
8 files changed, 26 insertions, 97 deletions
diff --git a/content/fiction/the-headless-angel.md b/content/fiction/the-headless-angel.md index cd46ab38..78c3a010 100644 --- a/content/fiction/the-headless-angel.md +++ b/content/fiction/the-headless-angel.md @@ -3,6 +3,7 @@ title = "电梯里的无头天使" date = 2025-02-17 14:53:54 draft = false aliases = ['/fictions/the-headless-angel/'] +tags = ['内阻力','抑郁'] +++ ## I diff --git a/i18n/zh.toml b/i18n/zh.toml index 018d9d66..09cd26b9 100644 --- a/i18n/zh.toml +++ b/i18n/zh.toml @@ -38,8 +38,9 @@ posts = "所有文章" cards = "所有卡片" [termPage] -cards = "相关卡片" books = "我读过的相关书籍" +weeklies = "提及此主题的周刊" +fictions = "我写过的关于这个主题的小说" [library] viewAllThisYear = "查看今年完整书单" diff --git a/layouts/_partials/term/term-fictions.html b/layouts/_partials/term/term-fictions.html new file mode 100644 index 00000000..3e3fd4a9 --- /dev/null +++ b/layouts/_partials/term/term-fictions.html @@ -0,0 +1,10 @@ +{{ $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-header.html b/layouts/_partials/term/term-header.html deleted file mode 100644 index 26bf7999..00000000 --- a/layouts/_partials/term/term-header.html +++ /dev/null @@ -1,20 +0,0 @@ -<div class="term-header"> - <div class="my-4 flex items-center"> - <span class="text-secondary">筛选:</span> - {{ if eq .Data.Singular "tag" }} - <button class="bg-transparent dark:invert" id="hide-weekly" - data-tooltip='{{ T "termFilterButton.hideWeekly" . }}'> - <img src="/img/crow.svg" alt="Hide Weekly" - class="w-6 h-6 block hover:animate-swing" /> - </button> - {{ end }} - <button class="bg-transparent dark:invert" id="reverse-order" - data-tooltip='{{ T "termFilterButton.reverseOrder" . }}'> - <img src="/img/clockwork.svg" alt="Reverse Order" - class="w-6 h-6 block hover:rotate-180 transition-transform" /> - </button> - </div> - {{ with .Params.description | markdownify }} - <p class="term-description">{{ . }}</p> - {{ end }} -</div> diff --git a/layouts/_partials/term/term-posts.html b/layouts/_partials/term/term-posts.html index 86e1b350..e9f8136f 100644 --- a/layouts/_partials/term/term-posts.html +++ b/layouts/_partials/term/term-posts.html @@ -1,6 +1,6 @@ <ul id="term-posts" class="animate-duration-100 ps-0 flex flex-col gap-2 list-none leading-relaxed"> - {{ range where .Pages "Section" "not in" (slice "cards" "library") }} + {{ range where .Pages "Section" "article" }} {{ partial "items/post-small" . }} {{ end }} </ul> diff --git a/layouts/_partials/term/term-scripts.html b/layouts/_partials/term/term-scripts.html deleted file mode 100644 index 45ac9ac6..00000000 --- a/layouts/_partials/term/term-scripts.html +++ /dev/null @@ -1,73 +0,0 @@ -<script> - const postList = document.getElementById("term-posts") - const reverseButton = document.getElementById("reverse-order") - const reverseOrder = () => { - // play exit animation - postList.classList.remove("animate-fade-in") - postList.classList.add("animate-fade-out") - setTimeout(() => { - // reverse order - postList.classList.toggle("flex-col") - postList.classList.toggle("flex-col-reverse") - - // play entrance animation - postList.classList.remove("animate-fade-out") - postList.classList.add("animate-fade-in") - }, 100) - } - reverseButton.addEventListener('click', reverseOrder) -</script> - -{{ if eq .Data.Singular "tag" }} -<script> - const hideWeeklyButton = document.getElementById("hide-weekly") - const weeklies = postList.querySelectorAll(".weekly") - - if (weeklies.length === 0) { - hideWeeklyButton.classList.add("hidden") - } - - const entranceAnimation = "animate-flip-in-x" - const exitAnimation = "animate-flip-out-x" - const animationDuration = 500 - - const toggleWeekly = () => { - if (postList.classList.contains("weekly-hidden")) { - // show weekly posts - postList.classList.remove("weekly-hidden") - weeklies.forEach(weekly => { - weekly.classList.remove("hidden!") - weekly.classList.add(entranceAnimation) - setTimeout(() => { - weekly.classList.remove(entranceAnimation) - }, animationDuration) - }) - } else { - // hide weekly posts - postList.classList.add("weekly-hidden") - weeklies.forEach(weekly => { - weekly.classList.add(exitAnimation) - setTimeout(() => { - weekly.classList.add("hidden!") - weekly.classList.remove(exitAnimation) - }, animationDuration) - }) - } - } - - const highlightClasses = ["animate-flash", "opacity-50"] - - const highlightWeekly = () => { - if (weeklies[0].classList.contains(highlightClasses[0])) return; - weeklies.forEach(e => e.classList.add(...highlightClasses)) - } - - const unhighlightWeekly = () => { - weeklies.forEach(e => e.classList.remove(...highlightClasses)) - } - - hideWeeklyButton.addEventListener("click", toggleWeekly) - hideWeeklyButton.addEventListener("mouseover", highlightWeekly) - hideWeeklyButton.addEventListener("mouseout", unhighlightWeekly) -</script> -{{ end }} diff --git a/layouts/_partials/term/term-weeklies.html b/layouts/_partials/term/term-weeklies.html new file mode 100644 index 00000000..56697b60 --- /dev/null +++ b/layouts/_partials/term/term-weeklies.html @@ -0,0 +1,10 @@ +{{ $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/term.html b/layouts/term.html index b0f66d5b..216f4d12 100644 --- a/layouts/term.html +++ b/layouts/term.html @@ -1,7 +1,6 @@ {{ define "main" }} <article> {{ partial "header" . }} - {{ partial "term/term-header" . }} <section> {{ with .Content }} <div class="markdown-body text-size-lg md:text-size-xl"> @@ -9,9 +8,10 @@ </div> {{ end }} {{ partial "term/term-posts" . }} + {{ partial "term/term-weeklies" . }} + {{ partial "term/term-fictions" . }} {{ partial "term/term-books" . }} </section> </article> - {{ partial "term/term-scripts" . }} {{ partial "footer" . }} {{ end }} |
