summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-04-18 20:28:29 +0800
committerEltrac <hi@guhub.cn>2025-04-18 20:28:29 +0800
commite2644c00ac4e059c3db7d03f2aa54af1ca60c952 (patch)
treef4ae01d6901fe287bc8ec2055d7eb7bf52566b5c /layouts
parentd667721bc5bc840401bdde5099ef24dbda9ceb78 (diff)
parent0eed452c61d6ce9d9cc524e4efec9fd10ec9a6de (diff)
Merge branch 'master' of https://github.com/BigCoke233/geek-death-project
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.html53
-rw-r--r--layouts/_default/taxonomy.html77
-rw-r--r--layouts/_default/term.html46
-rw-r--r--layouts/_default/uncategorized.html20
-rw-r--r--layouts/cards/single.html2
-rw-r--r--layouts/partials/components/comment.html7
-rw-r--r--layouts/posts/single.html85
7 files changed, 194 insertions, 96 deletions
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 }}