aboutsummaryrefslogtreecommitdiffstats
path: root/layouts/shortcodes/recent-posts.html
blob: 5bd7f3c5aa833e65564574aba428161a3b336d62 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 {{ $mode := 2 }}

{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}

{{ $recent := first 15 $pages.ByDate.Reverse }}


<div class="recent-posts">

    {{ if $recent }}

    <ul class="posts-list {{ if eq $mode 1 }}with-summary{{ else }}title-only{{ end }}" style="list-style: none;padding-left: 1;">


        {{ range $index, $post := $recent }}

        <li>


            <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time>


            <span class="post-link-wrapper">

                <a href="{{ .RelPermalink }}" class="post-title">{{ .Title }}</a>

            </span>


        </li>

        {{ end }}


    </ul>

    {{ else }}

    <p class="posts-empty">暂无随笔 / No posts found.</p>

    {{ end }}

</div>