diff options
Diffstat (limited to 'layouts/shortcodes')
| -rw-r--r-- | layouts/shortcodes/mastodon.html | 16 | ||||
| -rw-r--r-- | layouts/shortcodes/recent-posts.html | 55 |
2 files changed, 32 insertions, 39 deletions
diff --git a/layouts/shortcodes/mastodon.html b/layouts/shortcodes/mastodon.html index cfb15ca..e69de29 100644 --- a/layouts/shortcodes/mastodon.html +++ b/layouts/shortcodes/mastodon.html @@ -1,16 +0,0 @@ -<script type="module" src="https://unpkg.com/mastodon-widget"></script> - -<mastodon-widget account="Verdant@c7.io" limit="10" header="true"> -</mastodon-widget> - -<style> - header, - .post-title, - .post-info { - display: none !important; - } - - mastodon-weight { - background-color: black !important; - } -</style> diff --git a/layouts/shortcodes/recent-posts.html b/layouts/shortcodes/recent-posts.html index 7b3d855..297a760 100644 --- a/layouts/shortcodes/recent-posts.html +++ b/layouts/shortcodes/recent-posts.html @@ -1,7 +1,17 @@ -{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} -{{ $recent := first 8 $pages.ByDate.Reverse }} +{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{ +$recent := first 8 $pages.ByDate.Reverse }} <style> + +hr.item-split { + margin-bottom: 10px; + margin-top: 10px; + } + + p { + line-height: 35px; + } + .recent-list { margin: 0; } @@ -44,23 +54,22 @@ } .split { - margin: 0; - padding: 0; - display: inline; + margin: 0; + padding: 0; + display: inline; } .recent-posts-item { - margin-top: 0; - margin-bottom: 35px; + margin-top: 0; + margin-bottom: 0; } .recent-post-title { - margin-top: 2px; - margin-bottom: -10px; + margin-top: 2px; + margin-bottom: -10px; } @media (max-width: 720px) { - .post-date { min-width: auto; font-size: 0.85em; @@ -70,7 +79,7 @@ font-size: 1.05em; } - .item-link { + .item-link { white-space: normal; /* 允许换行 */ word-wrap: break-word; /* 强制长单词/链接换行 */ overflow: visible; /* 取消隐藏 */ @@ -80,16 +89,10 @@ </style> <div class="recent-posts"> - {{ if $recent }} - {{ range $index, $page := $recent }} - <div class="recent-posts-item"> - <h3 class="recent-post-title"> - <a href="{{ .RelPermalink }}" class="item-link">{{ .Title }}</a> - </h3> - + {{ if $recent }} {{ range $index, $page := $recent }} <div class="post-meta"> <span class="post-date"> - <time datetime='{{ .Date.Format "Jan 02, 2006" }}'>{{- .Date.Format (default "Jan 02, 2006" .Site.Params.dateFormat) -}}•</time> + <time datetime='{{ .Date.Format "Jan 02, 2006" }}'>{{- .Date.Format (default "Jan 02, 2006" .Site.Params.dateFormat) -}}·</time> </span> {{ with .Params.categories }} @@ -103,9 +106,15 @@ {{ end }} {{ end }} </div> - </div> - {{ end }} - {{ else }} - <div class="recent-empty">暂无文章</div> + <div class="recent-posts-item"> + <h3 class="recent-post-title"> + <a href="{{ .RelPermalink }}" class="item-link">{{ .Title }}</a> + </h3> + + <div class="summary">{{ .Summary }}</div> + </div> + <hr class="item-split"> + {{ end }} {{ else }} + <div class="recent-empty">暂无文章</div> {{ end }} </div> |
