summaryrefslogtreecommitdiffstats
path: root/layouts/shortcodes/recent-posts.html
blob: b1e891ee14cc74a2a8af3563b79a81d439c53f52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{
$recent := first 5 $pages.ByDate.Reverse }}

<style>
.item-link {
word-wrap: break-word;
  white-space: normal;
 }
</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>
    <div class="summary">{{ .Summary }}</div>

    {{ partial "post_meta.html" . }}

  {{ if not (eq (add $index 1) (len $recent)) }} {{ end }} {{ end }} {{ else }}
  <div class="recent-empty">暂无文章</div>
  {{ end }}
</div>