diff options
| author | Eltrac <hi@guhub.cn> | 2025-04-18 20:28:29 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-04-18 20:28:29 +0800 |
| commit | 8a0837ab2263a6fb0a5f9e9b2b7822d7f63835df (patch) | |
| tree | 27abaacfd46d875711e6aff2adac09174b546d7d | |
| parent | 2063436120146bbaa728d1e0a45da36923242a7e (diff) | |
| parent | d7d671526ddcb37dd64465b454f35504e6e3df93 (diff) | |
Merge branch 'master' of https://github.com/BigCoke233/geek-death-project
Former-commit-id: e2644c00ac4e059c3db7d03f2aa54af1ca60c952
21 files changed, 266 insertions, 101 deletions
diff --git a/assets/css/components/_card.scss b/assets/css/components/_card.scss index 787c4e2d..932ce6a5 100644 --- a/assets/css/components/_card.scss +++ b/assets/css/components/_card.scss @@ -46,7 +46,7 @@ } .card-page { - .referenced-articles { + .related-posts { h2 { font-size: 1.2rem; color: var(--secondary-text-color); diff --git a/assets/css/components/_comment.scss b/assets/css/components/_comment.scss index 6b1c0e92..82019dec 100644 --- a/assets/css/components/_comment.scss +++ b/assets/css/components/_comment.scss @@ -31,3 +31,19 @@ margin: 1rem 0 } } + +.telegram-link-container { + text-align: center; + display: flex; + justify-content: center; + a { + @include small-button; + font-size: .9rem; + display: inline-flex; + align-items: center; + gap: 0.25rem; + img { + width: 1rem; + } + } +} diff --git a/assets/css/components/_post.scss b/assets/css/components/_post.scss index 5ab58c85..01c0deff 100644 --- a/assets/css/components/_post.scss +++ b/assets/css/components/_post.scss @@ -82,3 +82,24 @@ } } } + +/* related posts */ + +.related-posts { + .related-posts-list { + padding-inline-start: 0; + .related-posts-item { + display: flex; + justify-content: space-between; + align-items: center; + .related-post-subtitle { + color: var(--secondary-text-color); + } + .related-post-reading-time { + font-family: var(--mono-font-family); + color: var(--secondary-text-color); + font-size: 0.9rem; + } + } + } +} diff --git a/assets/css/components/_postlist.scss b/assets/css/components/_postlist.scss index 8fb10f65..3369766e 100644 --- a/assets/css/components/_postlist.scss +++ b/assets/css/components/_postlist.scss @@ -2,7 +2,7 @@ @include small-button; &::after { - content: " »"; + content: " →"; } } @@ -102,6 +102,10 @@ } } +.taxonomy-description hr { + margin: 0.25rem 0; +} + .posts-item-category { a { border: 2px solid var(--border-color); diff --git a/assets/css/components/_taxonomy.scss b/assets/css/components/_taxonomy.scss index 7e90cec9..c295b07e 100644 --- a/assets/css/components/_taxonomy.scss +++ b/assets/css/components/_taxonomy.scss @@ -75,7 +75,11 @@ } } - .taxonomy-description hr { - + .uncategorized-link { + @include small-button; + &::after { + content: " →"; + color: var(--secondary-text-color) + } } } diff --git a/content/categories/uncategorized.md b/content/categories/uncategorized.md new file mode 100644 index 00000000..bfb38ee7 --- /dev/null +++ b/content/categories/uncategorized.md @@ -0,0 +1,4 @@ +--- +title: 未分类文章 +layout: uncategorized +--- diff --git a/content/posts/IN-LIBRIS-LIBERTAS.md b/content/posts/IN-LIBRIS-LIBERTAS.md index ceb6b165..0273160b 100644 --- a/content/posts/IN-LIBRIS-LIBERTAS.md +++ b/content/posts/IN-LIBRIS-LIBERTAS.md @@ -3,7 +3,6 @@ title: IN LIBRIS LIBERTAS subtitle: 2024 读书总结 date: 2024-12-12 23:33:00 draft: false -categories: 年终总结 tags: - 读书 toc: true diff --git a/content/posts/写在 2023 的开头.md b/content/posts/almanac/写在 2023 的开头.md index c3475dab..a088f8b0 100644 --- a/content/posts/写在 2023 的开头.md +++ b/content/posts/almanac/写在 2023 的开头.md @@ -2,6 +2,9 @@ categories: 年终总结 date: 2023-01-01 title: 写在 2023 的开头 +aliases: + - /posts/写在-2023-的开头/ + - /posts/写在2023的开头/ --- ## 一些改变和新的事物 diff --git a/content/posts/写在 2024 的开头.md b/content/posts/almanac/写在 2024 的开头.md index 594a16a0..52f424ff 100644 --- a/content/posts/写在 2024 的开头.md +++ b/content/posts/almanac/写在 2024 的开头.md @@ -8,6 +8,9 @@ tags: - 创作 - 自我 - 人际交往 +aliases: + - /posts/写在-2024-的开头/ + - /posts/写在2024的开头/ comments: - name: Broca date: 2024-01-02 diff --git a/content/posts/写在2025的开头.md b/content/posts/almanac/写在2025的开头.md index 43262324..1abde36d 100644 --- a/content/posts/写在2025的开头.md +++ b/content/posts/almanac/写在2025的开头.md @@ -1,5 +1,8 @@ --- title: 写在 2025 的开头 +aliases: + - /posts/写在-2025-的开头/ + - /posts/写在2025的开头/ subtitle: The Year of Change description: 这一年对我来说过得很快,我个人的变化也很大,这种转变我自己不太能描述清楚。写这行字的前一天晚上,辅导员来查寝,认了半天人,笑着说「你的形象跟大一比起来差距好大」。我笑着说确实。这些改变让我感到很自然,但当我往回看的时候,我才惊讶于时间居然只过去了一年的事实。 categories: 年终总结 diff --git a/content/posts/seasonal/2025-春.md b/content/posts/seasonal/2025-春.md new file mode 100644 index 00000000..fd0a7e69 --- /dev/null +++ b/content/posts/seasonal/2025-春.md @@ -0,0 +1,7 @@ +--- +title: +subtitle: 2025·春 +date: 2025-04-18 15:31:59 +draft: true +toc: true +---
\ No newline at end of file diff --git a/i18n/en.yml b/i18n/en.yml index 2a53c6d3..5d0ed65e 100644 --- a/i18n/en.yml +++ b/i18n/en.yml @@ -17,3 +17,4 @@ postNav: moreLinks: posts: 'All Posts' cards: 'All Cards' +relatedContent: 'Related Content' diff --git a/i18n/zh.yml b/i18n/zh.yml index f5335290..a827365d 100644 --- a/i18n/zh.yml +++ b/i18n/zh.yml @@ -18,3 +18,4 @@ cards: 最近在学 moreLinks: posts: '所有文章' cards: '所有卡片' +relatedContent: '相关文章' diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0796701f..bfe80ad5 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,46 +1,10 @@ {{ define "main" }} - {{ if eq .Type "posts" }} - {{ partial "components/post-page-header.html" . }} - {{ else }} - {{ partial "header.html" . }} - {{ end }} + {{ partial "header.html" . }} <article - class="post {{ .Site.Language.LanguageName }}" + class="page {{ .Site.Language.LanguageName }}" id="article" > - <!-- Post Header --> - <header - style="view-transition-name: post-{{ .File.UniqueID }}" - class="post-header" - > - {{ if in .Site.Params.mainSections .Type }} - {{ partial "components/banner.html" . }} - <!-- Title and Subtitle --> - <h1 class="post-title"> - {{ .Title }} - {{ with .Params.subtitle }} - <small class="post-subtitle">{{ . }}</small> - {{ end }} - </h1> - <!-- Post Meta --> - <div class="post-meta"> - {{ if .Date }} - <time class="post-date" datetime="{{ .Date.Format "2006-01-02 15:04:05 MST" }}"> - {{ .Date.Format "2006-1-2" }} - </time> - {{ end }} - <span>·</span> - {{ if .Params.categories }} - <a class="post-category" href="/categories/{{ .Params.categories | urlize }}">{{ .Params.categories }}</a> - {{ end }} - {{ range .Params.tags }} - <a class="post-tag" href="{{ site.LanguagePrefix }}/tags/{{ lower . | urlize }}/">#{{ . }}</a> - {{ end }} - </div> - {{ end }} - </header> - - <!-- Post Content --> + <!-- Content --> <div id="post-content" class="post-content markdown-body" style="view-transition-name: post-content-{{ .File.UniqueID }}"> {{ if .Params.toc }} @@ -48,15 +12,8 @@ {{ end }} {{ .Site.Params.postHeaderContent | safeHTML }} {{ .Content }} - {{ if and (eq .Site.Language.Lang "zh") (eq .Section "posts") }} - <p style="font-size: 0.9rem">如果你觉得文章对你有帮助,可以考虑<a href="/sponsor">赞助作者</a></p> - {{ end }} </div> - {{ if in .Site.Params.mainSections .Type }} - {{ partial "components/comment.html" . }} - {{ end }} - <script src="/js/tocbot.min.js"></script> <script> tocbot.init({ @@ -69,7 +26,5 @@ </script> </article> - {{ if ne .Type "posts" }} - {{ partial "footer.html" . }} - {{ end }} + {{ partial "footer.html" . }} {{ end }} diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index 6aaf3d46..ad1179e2 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -18,30 +18,63 @@ <!-- Display Categories --> {{ if eq .Type "categories" }} {{ partial "components/welcome.html" . }} - <section class="taxonomy-categories"> + {{ $featured := slice "稻草人周刊" "年终总结" "揽物日志" }} + <h2>周期性刊物</h2> + <section class="taxonomy-categories"> {{ range sort .Site.Taxonomies.categories ".Count" "desc" }} - <div class="taxonomy-categories-item"> - <h3 class="category-title"> - <a href="{{ .Page.RelPermalink }}"> - {{ with .Page.Params.icon }}<span>{{ . }}</span>{{ end }} {{ .Page.LinkTitle }} - </a> - </h3> - <p class="category-description">{{ .Page.Params.description | markdownify }}</p> - <ul class="category-articles"> - {{ range first 6 .Pages }} - <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> - {{ end }} - </ul> - {{ if gt .Count 6 }} - <a class="category-link" - href="{{ .Page.RelPermalink }}" - >阅读所有 {{ .Count }} 篇文章</a> - {{ end }} - </div> - {{ end }} - </section> - {{ end }} + {{ if in $featured .Page.Title }} + <div class="taxonomy-categories-item"> + <h3 class="category-title"> + <a href="{{ .Page.RelPermalink }}"> + {{ with .Page.Params.icon }}<span>{{ . }}</span>{{ end }} {{ .Page.LinkTitle }} + </a> + </h3> + <p class="category-description">{{ .Page.Params.description | markdownify }}</p> + <ul class="category-articles"> + {{ range first 6 .Pages }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} + </ul> + {{ if gt .Count 6 }} + <a class="category-link" + href="{{ .Page.RelPermalink }}" + >阅读所有 {{ .Count }} 篇文章</a> + {{ end }} + </div> + {{ end }} + {{ end }} + </section> + <!-- Render Other Categories --> + <h2>文章系列</h2> + <section class="taxonomy-categories"> + {{ range sort .Site.Taxonomies.categories ".Count" "desc" }} + {{ if not (in $featured .Page.Title) }} + <div class="taxonomy-categories-item"> + <h3 class="category-title"> + <a href="{{ .Page.RelPermalink }}"> + {{ with .Page.Params.icon }}<span>{{ . }}</span>{{ end }} {{ .Page.LinkTitle }} + </a> + </h3> + <p class="category-description">{{ .Page.Params.description | markdownify }}</p> + <ul class="category-articles"> + {{ range first 6 .Pages }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} + </ul> + {{ if gt .Count 6 }} + <a class="category-link" + href="{{ .Page.RelPermalink }}" + >阅读所有 {{ .Count }} 篇文章</a> + {{ end }} + </div> + {{ end }} + {{ end }} + </section> + {{ end }} + <p class="uncategorized-link-container"> + <a class="uncategorized-link" href="/categories/uncategorized/">查看未分类文章</a> + </p> </article> {{ partial "footer.html" . }} {{ end }} diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 7aac0646..43e86953 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -1,29 +1,29 @@ {{ define "main" }} <article class="posts termlist-page"> - {{ partial "components/post-page-header.html" . }} - {{ partial "components/breadcrumbs.html" . }} + {{ partial "components/post-page-header.html" . }} + {{ partial "components/breadcrumbs.html" . }} - {{ with .Params.description }} - <div class="taxonomy-description markdown-body"> - {{ . | markdownify }} - <hr /> - </div> - {{ end }} + {{ with .Params.description }} + <div class="taxonomy-description markdown-body"> + {{ . | markdownify }} + <hr /> + </div> + {{ end }} - <div class="term-list"> - <ul> - {{ range .Pages }} - <li> - <a href="{{ .RelPermalink }}" data-umami-event="Click Post Link from Category Page"> - {{ .Title }}{{ with .Params.subtitle }}:<span class="posts-subtitle">{{. }}</span> - {{ end }} - </a> - <time> - {{ .Date.Format "2006-1-2" }} - </time> - </li> - {{ end }} - </ul> - </div> + <div class="term-list"> + <ul> + {{ range .Pages }} + <li> + <a href="{{ .RelPermalink }}" data-umami-event="Click Post Link from Category Page"> + {{ .Title }}{{ with .Params.subtitle }}:<span class="posts-subtitle">{{. }}</span> + {{ end }} + </a> + <time> + {{ .Date.Format "2006-1-2" }} + </time> + </li> + {{ end }} + </ul> + </div> </article> {{ end }} diff --git a/layouts/_default/uncategorized.html b/layouts/_default/uncategorized.html new file mode 100644 index 00000000..1f777025 --- /dev/null +++ b/layouts/_default/uncategorized.html @@ -0,0 +1,20 @@ +{{ define "main" }} + <article class="posts termlist-page"> + {{ partial "components/post-page-header.html" . }} + {{ partial "components/breadcrumbs.html" . }} + <div class="post-content"> + <!-- Uncategorized --> + {{ $uncategorized := where (where .Site.RegularPages "Section" "posts") "Params.categories" "==" nil }} + {{ if $uncategorized }} + <section class="uncategorized-posts"> + <ol> + {{ range $uncategorized }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} + </ol> + </section> + {{ end }} + </div> + </article> +{{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/cards/single.html b/layouts/cards/single.html index 58f712d3..0048ad4d 100644 --- a/layouts/cards/single.html +++ b/layouts/cards/single.html @@ -31,7 +31,7 @@ {{- /* 如果有文章引用这个卡片,就显示它们 */ -}} {{ if gt (len $referencedBy) 0 }} - <section class="referenced-articles post-content"> + <section class="related-posts post-content"> <h2>引用了本卡片的文章</h2> <ul> {{- range $referencedBy }} diff --git a/layouts/partials/components/comment.html b/layouts/partials/components/comment.html index cfdfa886..64f3d554 100644 --- a/layouts/partials/components/comment.html +++ b/layouts/partials/components/comment.html @@ -26,7 +26,12 @@ </p> </div> {{ if eq .Site.Language.Lang "zh" }} - <p style="text-align:center">你也可以加入本站的 <a href="https://t.me/teaparty418" target="_blank">Telegram 群组</a>参与讨论</p> + <p class="telegram-link-container"> + <a href="https://t.me/teaparty418" target="_blank"> + <img src="/img/telegram.svg" alt="Telegram Logo" /> + 加入本站的 Telegram 群组参与讨论 + </a> + </p> {{ end }} <!-- giscus script --> <script id="giscus-script" diff --git a/layouts/posts/single.html b/layouts/posts/single.html new file mode 100644 index 00000000..efea94f0 --- /dev/null +++ b/layouts/posts/single.html @@ -0,0 +1,85 @@ +{{ define "main" }} + {{ partial "components/post-page-header.html" . }} + <article + class="post {{ .Site.Language.LanguageName }}" + id="article" + > + <!-- Post Header --> + <header + style="view-transition-name: post-{{ .File.UniqueID }}" + class="post-header" + > + {{ partial "components/banner.html" . }} + <!-- Title and Subtitle --> + <h1 class="post-title"> + {{ .Title }} + {{ with .Params.subtitle }} + <small class="post-subtitle">{{ . }}</small> + {{ end }} + </h1> + <!-- Post Meta --> + <div class="post-meta"> + {{ if .Date }} + <time class="post-date" datetime="{{ .Date.Format "2006-01-02 15:04:05 MST" }}"> + {{ .Date.Format "2006-1-2" }} + </time> + {{ end }} + <span>·</span> + {{ if .Params.categories }} + <a class="post-category" href="/categories/{{ .Params.categories | urlize }}">{{ .Params.categories }}</a> + {{ end }} + {{ range .Params.tags }} + <a class="post-tag" href="{{ site.LanguagePrefix }}/tags/{{ lower . | urlize }}/">#{{ . }}</a> + {{ end }} + </div> + </header> + + <!-- Post Content --> + <div id="post-content" class="post-content markdown-body" + style="view-transition-name: post-content-{{ .File.UniqueID }}"> + {{ if .Params.toc }} + <div id="toc-container"><div id="toc"></div></div> + {{ end }} + {{ .Site.Params.postHeaderContent | safeHTML }} + {{ .Content }} + {{ if eq .Site.Language.Lang "zh" }} + <p style="font-size: 0.9rem">如果你觉得文章对你有帮助,可以考虑<a href="/sponsor">赞助作者</a></p> + {{ end }} + </div> + + <!-- Comment --> + {{ partial "components/comment.html" . }} + + <!-- Related Posts --> + {{ with site.RegularPages.Related . | first 3 }} + <div class="related-posts post-content"> + <h4>{{ T "relatedContent" }}</h4> + <ul class="related-posts-list"> + {{ range . }} + <li class="related-posts-item"> + <a href="{{ .RelPermalink }}"> + {{ .LinkTitle }} + {{ with .Params.subtitle }} + <span class="related-post-subtitle">:{{ . }}</span> + {{ end }} + </a> + <span class="related-post-reading-time">⏱️ {{ .ReadingTime }}min </span> + </li> + {{ end }} + </ul> + </div> + {{ end }} + + <script src="/js/tocbot.min.js"></script> + <script> + tocbot.init({ + tocSelector: '#toc', + contentSelector: '#post-content', + headingSelector: 'h2, h3:not(blockquote > h3)', + hasInnerContainers: true, + scrollSmoothOffset: -30 + }); + </script> + + </article> +{{ end }} diff --git a/static/img/telegram.svg b/static/img/telegram.svg new file mode 100644 index 00000000..854bb6a5 --- /dev/null +++ b/static/img/telegram.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48px" height="48px"><path fill="#29b6f6" d="M24 4A20 20 0 1 0 24 44A20 20 0 1 0 24 4Z"/><path fill="#fff" d="M33.95,15l-3.746,19.126c0,0-0.161,0.874-1.245,0.874c-0.576,0-0.873-0.274-0.873-0.274l-8.114-6.733 l-3.97-2.001l-5.095-1.355c0,0-0.907-0.262-0.907-1.012c0-0.625,0.933-0.923,0.933-0.923l21.316-8.468 c-0.001-0.001,0.651-0.235,1.126-0.234C33.667,14,34,14.125,34,14.5C34,14.75,33.95,15,33.95,15z"/><path fill="#b0bec5" d="M23,30.505l-3.426,3.374c0,0-0.149,0.115-0.348,0.12c-0.069,0.002-0.143-0.009-0.219-0.043 l0.964-5.965L23,30.505z"/><path fill="#cfd8dc" d="M29.897,18.196c-0.169-0.22-0.481-0.26-0.701-0.093L16,26c0,0,2.106,5.892,2.427,6.912 c0.322,1.021,0.58,1.045,0.58,1.045l0.964-5.965l9.832-9.096C30.023,18.729,30.064,18.416,29.897,18.196z"/></svg>
\ No newline at end of file |
