summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-04-29 13:41:03 +0800
committerEltrac <hi@guhub.cn>2025-04-29 13:41:03 +0800
commitf2b8c53bb441c1ed455c0aa45b4e29305323a11f (patch)
tree18ff6b3022e83021dd893c9bdfdfdeaa87d5ab76 /layouts
parent9088049e3296ac1760d28bb5d68402d985988b8b (diff)
parent565bb73eaa8c858211892044032343ce67933072 (diff)
Merge branch 'master' of https://github.com/BigCoke233/geek-death-project
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/taxonomy.html64
-rw-r--r--layouts/cards/section.html12
-rw-r--r--layouts/categories/taxonomy.html67
-rw-r--r--layouts/partials/components/global-search.html13
-rw-r--r--layouts/term/term.html (renamed from layouts/_default/term.html)2
5 files changed, 91 insertions, 67 deletions
diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html
index e4ad0753..025a63d7 100644
--- a/layouts/_default/taxonomy.html
+++ b/layouts/_default/taxonomy.html
@@ -4,7 +4,6 @@
{{ partial "components/postnav.html" . }}
<!-- Display Tags -->
- {{ if eq .Type "tags" }}
<section class="taxonomy-tags">
{{ range sort .Site.Taxonomies.tags "Count" "desc" }}
<a href="{{ .Page.RelPermalink }}" class="taxonomy-tags-item">
@@ -13,69 +12,6 @@
</a>
{{ end }}
</section>
- {{ end }}
-
- <!-- Display Categories -->
- {{ if eq .Type "categories" }}
- {{ partial "components/welcome.html" . }}
- {{ $featured := slice "稻草人周刊" "年终总结" "揽物日志" "极客死亡计划书" }}
- <h2>周期性刊物</h2>
- <section class="taxonomy-categories">
- {{ range sort .Site.Taxonomies.categories ".Count" "desc" }}
- {{ 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>
-
- <p class="uncategorized-link-container">
- <a class="uncategorized-link" href="/categories/uncategorized/">查看随笔</a>
- </p>
- {{ end }}
</article>
{{ partial "footer.html" . }}
{{ end }}
diff --git a/layouts/cards/section.html b/layouts/cards/section.html
index 61e01516..1e7254e3 100644
--- a/layouts/cards/section.html
+++ b/layouts/cards/section.html
@@ -1,9 +1,17 @@
{{ define "main" }}
<article class="card-list">
{{ partial "header.html" . }}
- <div id="cards-section">
+ <div class="cards-statistics markdown-body">
+ <table>
+ <tr>
+ <td>卡片数量</td>
+ <td><span class="number-pill">{{ len .Pages }}</span></td>
+ </tr>
+ </table>
+ </div>
+ <div class="cards-section outbox small">
{{- $cards := .Site.GetPage "section" "cards" }} <!-- 获取 "cards" 部分的内容 -->
- {{- $paginator := .Paginate $cards.Pages 8 }} <!-- 对该部分内容进行分页 -->
+ {{- $paginator := .Paginate $cards.Pages 10 }} <!-- 对该部分内容进行分页 -->
{{- range $paginator.Pages }}
<div class="card"
style="view-transition-name: card-{{ .File.UniqueID }}">
diff --git a/layouts/categories/taxonomy.html b/layouts/categories/taxonomy.html
new file mode 100644
index 00000000..5b6748d0
--- /dev/null
+++ b/layouts/categories/taxonomy.html
@@ -0,0 +1,67 @@
+{{ define "main" }}
+<article class="taxonomy">
+ {{ partial "header.html" . }}
+ {{ partial "components/postnav.html" . }}
+
+ <!-- Display Categories -->
+ {{ partial "components/welcome.html" . }}
+ {{ $featured := slice "稻草人周刊" "年终总结" "揽物日志" "极客死亡计划书" }}
+ <h2>周期性刊物</h2>
+ <section class="taxonomy-categories">
+ {{ range sort .Site.Taxonomies.categories ".Count" "desc" }}
+ {{ 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>
+
+ <p class="uncategorized-link-container">
+ <a class="uncategorized-link" href="/categories/uncategorized/">查看随笔</a>
+ </p>
+</article>
+{{ partial "footer.html" . }}
+{{ end }}
diff --git a/layouts/partials/components/global-search.html b/layouts/partials/components/global-search.html
index 5b158abe..c6d76fa8 100644
--- a/layouts/partials/components/global-search.html
+++ b/layouts/partials/components/global-search.html
@@ -1,4 +1,5 @@
<div id="global-search">
+ <div id="global-search-close">×</div>
{{ partial "components/pagefind" . }}
</div>
<div id="global-search-overlay"></div>
@@ -37,6 +38,14 @@
bottom: 0;
align-items: center;
justify-content: center;
+ #global-search-close {
+ position: absolute;
+ top: 0;
+ right: 0;
+ padding: 0 1rem;
+ font-size: 3rem;
+ cursor: pointer;
+ }
}
#global-search #pagefind {
@@ -90,6 +99,7 @@
window.addEventListener("keydown", (event) => {
if (event.key === 'k' && (event.metaKey || event.ctrlKey)) {
+ event.preventDefault();
// Open the popup window
if (search.classList.contains("shown")) {
turnOff()
@@ -116,5 +126,8 @@
// double-click to turn off search
// in case esc and ctrl/cmd+k cannot be used
search.addEventListener("dblclick", turnOff);
+
+ const closeButton = document.getElementById("global-search-close");
+ closeButton.addEventListener("click", turnOff);
})();
</script>
diff --git a/layouts/_default/term.html b/layouts/term/term.html
index 7cab2827..7d17833a 100644
--- a/layouts/_default/term.html
+++ b/layouts/term/term.html
@@ -24,7 +24,7 @@
</li>
{{ end }}
</ul>
- <div class="term-list-cards">
+ <div class="term-list-cards cards-section outbox small">
{{ range where .Pages "Section" "eq" "cards" }}
<div class="card">
<h3>