aboutsummaryrefslogtreecommitdiffstats
path: root/layouts/shortcodes/recent-posts.html
blob: ea6ed2b3b969c4598c14a82c8a520efba0eb4df5 (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
25
26
27
28
29
30
{{ $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"> -->
<!-- {{ range $index, $page := $recent }} -->
<!-- {{ end }} -->
<!-- </div> -->

<div class="recent-posts">
  {{ if $recent }} {{ range $index, $page := $recent }}
  <div class="recent-posts-item">
    <h2 class="recent-post-title post-title">
      <a href="{{ .RelPermalink }}" class="item-link">{{ .Title }}</a>
    </h2>
    <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>