From 88c8c36d02a24ed5de9933480794194646a868fc Mon Sep 17 00:00:00 2001 From: fukunee Date: Sun, 15 Nov 2026 09:18:36 +0800 Subject: [PATCH] Make blog list cards fully clickable --- .gitignore | 3 +++ assets/css/custom.css | 24 +++++++++++++++++------- layouts/blog/list.html | 32 ++++++++++++-------------------- layouts/hextra-home.html | 2 +- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index 1157df6..04be2c1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ public/ # OS files .DS_Store Thumbs.db + +# Local build check output +tmpcheck/ diff --git a/assets/css/custom.css b/assets/css/custom.css index 354c52a..db53604 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -186,30 +186,40 @@ figcaption.post-caption { } .footer-roadmap { padding: 1rem 0; } -/* ===== Homepage post list: entire card is clickable ===== */ -#post-list .home-post-item { +/* ===== Post lists (home + /blog): whole card is one clickable link ===== */ +#post-list .post-card { display: block; color: inherit; text-decoration: none; border-radius: 0.5rem; padding: 0.75rem 1rem; - margin: 0 -1rem 0.5rem; + margin: 0 -1rem; transition: background-color 0.15s ease; } -#post-list .home-post-item h3 { +#post-list .post-card h3 { margin-top: 0; } -#post-list .home-post-item:hover { +#post-list .post-card:hover { background-color: rgba(0, 0, 0, 0.04); } -html.dark #post-list .home-post-item:hover { +html.dark #post-list .post-card:hover { background-color: rgba(255, 255, 255, 0.06); } -#post-list .home-post-item:focus-visible { +#post-list .post-card:focus-visible { outline: 2px solid var(--hx-color-primary-500, currentColor); outline-offset: 2px; } + +/* Home: spacing between cards */ +#post-list .home-post-item { + margin-bottom: 0.5rem; +} + +/* /blog list: keep the original item rhythm (旧 hx:mb-10 + h3 mt-8 的视觉间距) */ +#post-list .blog-post-item { + margin-bottom: 1rem; +} diff --git a/layouts/blog/list.html b/layouts/blog/list.html index 00e3232..28e8d4b 100644 --- a/layouts/blog/list.html +++ b/layouts/blog/list.html @@ -21,34 +21,26 @@
{{- range $i, $p := $pages }} + {{- /* 整块卡片即一个链接:框内任意位置点击都进入文章; + 标签放在卡片外面,保证标签本身仍是可点链接 */}}
-

- {{ $p.Title }} -

-

- {{ partial "utils/format-date" $p.Date }} -

+ +

{{ $p.Title }}

+

+ {{ partial "utils/format-date" $p.Date }} +

+

+ {{- partial "utils/page-description" $p -}} +

+
{{ if site.Params.blog.list.displayTags }}
{{ partial "tags.html" (dict "context" $p) }}
{{ end }} - -

- {{- partial "utils/page-description" $p -}} -

-
{{- end }}
diff --git a/layouts/hextra-home.html b/layouts/hextra-home.html index c21465a..6d57c07 100644 --- a/layouts/hextra-home.html +++ b/layouts/hextra-home.html @@ -18,7 +18,7 @@ {{- /* 整块卡片即一个链接:框内任意位置点击都进入文章 */}}

{{ $p.Title }}