diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/partials/style.html | 4 | ||||
| -rw-r--r-- | layouts/shortcodes/recent-posts.html | 37 |
2 files changed, 24 insertions, 17 deletions
diff --git a/layouts/partials/style.html b/layouts/partials/style.html index e922440..14b2eea 100644 --- a/layouts/partials/style.html +++ b/layouts/partials/style.html @@ -31,7 +31,7 @@ } img.missing { - display: none; + display: none; } nav a, @@ -79,7 +79,7 @@ } h1.post-title { - margin-top: 5vh; + margin-top: 2vh; margin-bottom: 10px; text-align: center; } 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> |
