summaryrefslogtreecommitdiffstats
path: root/layouts/shortcodes/recent-posts.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/shortcodes/recent-posts.html')
-rw-r--r--layouts/shortcodes/recent-posts.html55
1 files changed, 32 insertions, 23 deletions
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>