From 48b656c949000ec88d6e46afbdb8d2d6adf10d70 Mon Sep 17 00:00:00 2001 From: Verdant Date: Sat, 28 Mar 2026 15:47:16 +0800 Subject: style: refactor CSS style --- hugo.toml | 36 +--------- layouts/archives/single.html | 125 ++++++++++++++++++++++++++--------- layouts/partials/style.html | 74 +++++++++------------ layouts/shortcodes/recent-posts.html | 17 +++-- 4 files changed, 140 insertions(+), 112 deletions(-) diff --git a/hugo.toml b/hugo.toml index d62a255..6dd4800 100644 --- a/hugo.toml +++ b/hugo.toml @@ -59,11 +59,7 @@ tabWidth = 4 name = "归档" url = "/archives/" weight = 4 - [[languages.zh-cn.menu.main]] - name = "书单" - url = "/readings/" - weight = 5 - [[languages.zh-cn.menu.main]] + [[languages.zh-cn.menu.main]] name = "关于" url = "/about/" weight = 6 @@ -93,41 +89,13 @@ tabWidth = 4 name = "About" url = "/about/" weight = 6 - -# [menu] - -# [[menu.main]] -# name = "分类" -# url = "/categories/" -# weight = 2 - -# [[menu.main]] -# name = "友人" -# url = "/links/" -# weight = 3 - -# [[menu.main]] -# name = "归档" -# url = "/archives" -# weight = 3 - -# [[menu.main]] -# name = "书单" -# url = "/readings" -# weight = 3 - -# [[menu.main]] -# name = "关于" -# url = "/about" -# weight = 6 - [params] upvote = true upvoteURL = "https://upvote.glowisle.me/" description = "关于互联网、书籍、生活琐事以及那些一闪而过的念头。计算机技术 & 读书感悟 & 日常随笔。映屿(GlowIsle)" postSearch = false groupByYear = true - toc = true + toc = false showPostCount = true favicon = "/favicon.png" hideMadeWithLine = true diff --git a/layouts/archives/single.html b/layouts/archives/single.html index efafdca..be44c9f 100644 --- a/layouts/archives/single.html +++ b/layouts/archives/single.html @@ -1,42 +1,107 @@ {{ define "main" }} -
{{- partial "header.html" . -}}
+
+{{- partial "header.html" . -}} +
+ {{ if .Data.Singular }} +

Filtering for "{{ .Title }}"

+ + Remove filter + + {{ end }} + + {{ if .Site.Params.postSearch }} + + + {{ end }} + {{ $allPosts := where .Site.RegularPages "Type" "eq" "posts" }} {{ $excludePosts := where $allPosts "Params.categories" "intersect" (slice "1") }} - {{ $postPages := $allPosts | complement $excludePosts }} + {{ $postPages := ($allPosts | complement $excludePosts) }} {{ if .Site.Params.showPostCount }} -

共 {{ len $postPages }} 篇文章

+

There {{ if le (len $postPages) 1 }} is {{ len $postPages }} piece. {{ else }} are {{ len $postPages }} pieces. {{ end }}

{{ end }} -
- {{ if gt (len $postPages) 0 }} - {{ range $postPages.GroupByDate "2006" }} -
- -

{{ .Key }} 年 ({{ len .Pages }})

-
- -
    - {{ range .Pages }} -
  • - - - - - - {{ .Title }} -
  • - {{ end }} -
-
+
    + {{ $currentYear := 0 }} + {{ range $postPages }} + {{ if .Site.Params.groupByYear }} + {{ $year := .Date.Year }} + {{ if ne $year $currentYear }} +

    {{ $year }}

    + {{ $currentYear = $year }} + {{ end }} {{ end }} +
  • + + + + + + {{ .Title }} +
  • {{ else }} -

    暂无文章

    +
  • No posts yet
  • {{ end }} -
+ + + {{ if .Data.Singular }} + {{ else }} + +
+ {{ range .Site.Taxonomies.tags }} + #{{ .Page.Title }}  + {{ end }} +
+
+ {{ end }}
-
-{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/partials/style.html b/layouts/partials/style.html index 4b29810..1297f6d 100644 --- a/layouts/partials/style.html +++ b/layouts/partials/style.html @@ -1,10 +1,10 @@
-

最近更新

{{ if $recent }}
{{ end }} {{ else }} -- cgit v1.2.3