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 | e2644c00ac4e059c3db7d03f2aa54af1ca60c952 (patch) | |
| tree | f4ae01d6901fe287bc8ec2055d7eb7bf52566b5c /layouts/_default | |
| parent | d667721bc5bc840401bdde5099ef24dbda9ceb78 (diff) | |
| parent | 0eed452c61d6ce9d9cc524e4efec9fd10ec9a6de (diff) | |
Merge branch 'master' of https://github.com/BigCoke233/geek-death-project
Diffstat (limited to 'layouts/_default')
| -rw-r--r-- | layouts/_default/single.html | 53 | ||||
| -rw-r--r-- | layouts/_default/taxonomy.html | 77 | ||||
| -rw-r--r-- | layouts/_default/term.html | 46 | ||||
| -rw-r--r-- | layouts/_default/uncategorized.html | 20 |
4 files changed, 102 insertions, 94 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 }} |
