From 5b1ddd7cc2ad7f334b1d29b7374c818614e654bd Mon Sep 17 00:00:00 2001 From: verdant Date: Sun, 22 Mar 2026 11:30:43 +0800 Subject: style: refactor index layout --- layouts/shortcodes/recent-posts.html | 140 ++++++++++++++++++++++++++++++----- 1 file changed, 123 insertions(+), 17 deletions(-) (limited to 'layouts/shortcodes/recent-posts.html') diff --git a/layouts/shortcodes/recent-posts.html b/layouts/shortcodes/recent-posts.html index ea6ed2b..a666a4c 100644 --- a/layouts/shortcodes/recent-posts.html +++ b/layouts/shortcodes/recent-posts.html @@ -1,30 +1,136 @@ {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{ -$recent := first 5 $pages.ByDate.Reverse }} +$recent := first 6 $pages.ByDate.Reverse }} + .item-link { + word-wrap: break-word; + white-space: normal; + } + .recent-list { + margin: 0; + } + .post-meta { + margin-bottom: 5px; + } + .recent-item { + position: relative; + margin-bottom: 8px; + flex-shrink: 0; + } + .split { + margin: 0; + padding: 0; + display: inline; + } + .recent-posts-item { + margin-top: 0; + margin-bottom: 35px; + } + .recent-post-title { + margin-top: 2px; + margin-bottom: -10px; - - - - + } + @media (max-width: 720px) { + .post-date { + min-width: auto; + font-size: 1.05em; + } + .item-link { + white-space: normal; /* 允许换行 */ + word-wrap: break-word; /* 强制长单词/链接换行 */ + overflow: visible; /* 取消隐藏 */ + text-overflow: clip; /* 取消省略号 */ + } + } + .category-link { + font-size: 0.9em; + } + .recent-empty { + text-align: center; + font-style: italic; + } +
- {{ if $recent }} {{ range $index, $page := $recent }} + + {{ if $recent }} + {{ range $index, $page := $recent }}
-

+

{{ .Title }} -

-
{{ .Summary }}
+ - {{ partial "post_meta.html" . }} +{{ if ne (.Params.showMeta | default true) false }} + +{{ end }} + + + + + + + + + + + + + + + + + + + + + + + + +
{{ end }} + {{ else }} +
暂无文章
+ +
+ +{{ end }} + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3