diff options
| author | Eltrac <hi@guhub.cn> | 2025-04-18 16:41:11 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-04-18 16:41:11 +0800 |
| commit | be5321a9ac8d4038cdc2520677103838cd389944 (patch) | |
| tree | ad807b7ca76e16960d5c21652fef158514637237 | |
| parent | 7bba3786bdd7628962e7d780298de633fb85486e (diff) | |
feat: add a page listing all uncategorized posts
| -rw-r--r-- | assets/css/components/_taxonomy.scss | 8 | ||||
| -rw-r--r-- | content/categories/uncategorized.md | 4 | ||||
| -rw-r--r-- | layouts/_default/taxonomy.html | 5 | ||||
| -rw-r--r-- | layouts/_default/uncategorized.html | 20 |
4 files changed, 33 insertions, 4 deletions
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/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index 8f449506..ad1179e2 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -72,8 +72,9 @@ {{ 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/uncategorized.html b/layouts/_default/uncategorized.html new file mode 100644 index 00000000..44dd79f5 --- /dev/null +++ b/layouts/_default/uncategorized.html @@ -0,0 +1,20 @@ +{{ define "main" }} +<article class="taxonomy"> + {{ 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 }} |
