diff options
| author | yingyu5658 <i@yingyu5658.me> | 2025-12-21 15:36:23 +0800 |
|---|---|---|
| committer | yingyu5658 <i@yingyu5658.me> | 2025-12-21 15:36:23 +0800 |
| commit | 66543c0b3449b5dfc48c3b6a62b0387788b69d3f (patch) | |
| tree | 5e0049f53d472af416b6cf04eb2f901419c5d076 /layouts/shortcodes/recent-posts.html | |
| parent | 3df49f7ee0e262e1a6006f7be311fb0c02c4a7f7 (diff) | |
| download | blog-66543c0b3449b5dfc48c3b6a62b0387788b69d3f.tar.gz blog-66543c0b3449b5dfc48c3b6a62b0387788b69d3f.zip | |
chore: set up weekly archetype and refine homepage layout
* Remove the banner in index.md
* Add default cover and ending template to weekly.md archetype
* Remove the banner from homepage
* Refactor recent-posts.md
* tweak related CSS styles
Diffstat (limited to 'layouts/shortcodes/recent-posts.html')
| -rw-r--r-- | layouts/shortcodes/recent-posts.html | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/layouts/shortcodes/recent-posts.html b/layouts/shortcodes/recent-posts.html index c6c1a3e..0d1d955 100644 --- a/layouts/shortcodes/recent-posts.html +++ b/layouts/shortcodes/recent-posts.html @@ -1,5 +1,5 @@ {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{ -$recent := first 5 $pages.ByDate.Reverse }} +$recent := first 8 $pages.ByDate.Reverse }} <style> .recent-list { margin: 0; @@ -15,7 +15,6 @@ $recent := first 5 $pages.ByDate.Reverse }} .item-link { display: inline-block; text-decoration: none; - margin-left: 10px; flex: 1; white-space: nowrap; overflow: hidden; @@ -34,22 +33,30 @@ $recent := first 5 $pages.ByDate.Reverse }} text-align: center; font-style: italic; } + + .recent-post-item { + margin-bottom: 1em; + } + + .recent-post-title { + margin-top: 2px; + } </style> <div class="recent-posts"> - {{ if $recent }} - <ul class="recent-list"> - {{ range $index, $page := $recent }} - <li class="recent-item"> - <span class="post-date"> - <time datetime='{{ .Date.Format "2006-01-02" }}'> - {{ .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }} - </time> - </span> + {{ if $recent }} {{ range $index, $page := $recent }} + + <div class="recent-post-item"> + <span class="post-date"> + <time datetime='{{ .Date.Format "2006-01-02" }}'> + {{ .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }} + </time> + </span> + + <h3 class="recent-post-title"> <a href="{{ .RelPermalink }}" class="item-link">{{ .Title }}</a> - </li> - {{ end }} - </ul> - {{ else }} + </h3> + </div> + {{ end }} {{ else }} <p class="recent-empty">暂无文章</p> {{ end }} </div> |
