From 31cd7a3067a9996b7140aeaefb6c97e08db2f78f Mon Sep 17 00:00:00 2001 From: verdant Date: Sat, 11 Apr 2026 18:27:20 +0800 Subject: update --- layouts/partials/custom_head.html | 18 +- layouts/partials/footer.html | 12 +- layouts/partials/post_meta.html | 37 +- layouts/partials/style.html | 811 -------------------------------------- layouts/partials/toc.html | 110 +----- 5 files changed, 36 insertions(+), 952 deletions(-) delete mode 100644 layouts/partials/style.html (limited to 'layouts/partials') diff --git a/layouts/partials/custom_head.html b/layouts/partials/custom_head.html index 5d5c1ed..b3e5d2a 100644 --- a/layouts/partials/custom_head.html +++ b/layouts/partials/custom_head.html @@ -1,19 +1,7 @@ - - - diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 5cd0d54..69e3e66 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,8 +1,8 @@ diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html index 1c180c3..1771751 100644 --- a/layouts/partials/post_meta.html +++ b/layouts/partials/post_meta.html @@ -1,33 +1,12 @@ {{ if ne (.Params.showMeta | default true) false }}
- - - - - - {{ if eq .Kind "page" }} - - {{ end }} + {{ if eq .Kind "page" }} + + {{ end }}
{{ end }} - - diff --git a/layouts/partials/style.html b/layouts/partials/style.html deleted file mode 100644 index f314c0e..0000000 --- a/layouts/partials/style.html +++ /dev/null @@ -1,811 +0,0 @@ - diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 66936a4..101c5e9 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -1,91 +1,19 @@ -{{/* 根据页面内容生成目录 */}} -{{ if and .TableOfContents (ne .TableOfContents "") }} - - - -{{ end }} \ No newline at end of file +{{ $hasHeadings := false }} +{{ if .RawContent }} + {{/* 正则匹配:查找以 1 到 6 个 # 开头的行 */}} + {{ $headings := findRE "(?m)^#{1,6} " .RawContent }} + {{ if gt (len $headings) 0 }} + {{ $hasHeadings = true }} + {{ end }} +{{ end }} + +{{ if $hasHeadings }} + +{{ end }} -- cgit v1.2.3