summaryrefslogtreecommitdiff
path: root/layouts/partials/list/post-card.html
blob: 254cc6b2f75d8b63645311b88e517c406bfbca33 (plain)
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
47
48
49
50
51
52
{{- $post := . }}
<article class="post-card">
    <header class="post-card__header">
        <h3 class="post-card__title">
            <a href="{{ $post.RelPermalink }}" class="post-card__link">
                {{ $post.Title }}
            </a>
        </h3>
        <div class="post-card__meta">
            <time datetime="{{ $post.Date.Format "2006-01-02T15:04:05Z07:00" }}" class="post-card__publish-date">
                {{ $post.Date | time.Format ":date_medium" }}
            </time>
            <!-- Uncomment for post meta info 
            <p class="post-card__meta-info">
                <span class="post-card__reading-time">
                    {{ lang.Translate "list.reading_time" $post.ReadingTime | default (printf "Estimated reading time: %s min" $post.ReadingTime) }}
                </span>
                |
                <span class="post-card__word-count">
                    {{ lang.Translate "list.word_count" $post.WordCount | default (printf "%s words" $post.WordCount) }}
                </span>
            </p>
            -->
        </div>
    </header>

    {{- with $post.Summary }}
        <div class="post-card__summary">
            {{ . }}
        </div>
    {{- end }}

    {{- with $post.Params.tags }}
        <footer class="post-card__tags">
            <ul class="post-card__tags-list">
                {{- range first 3 . }}
                    <li class="post-card__tags-item">
                        #{{ . }}
                    </li>
                {{- end }}
                {{- if gt (len .) 3 }}
                    <li class="post-card__tags-item post-card__tags-more">
                        <span class="post-card__tags-more-count">
                            +{{ sub (len .) 3 }} {{ lang.Translate "common.more" | default "more" }}
                        </span>
                    </li>
                {{- end }}
            </ul>
        </footer>
        <hr />
    {{- end }}
</article>