aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/layouts/partials/card.html
blob: c451066f752e8478f60a825ba30576d5b604a28b (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
47
48
49
50
51
52
53
{{ $cardConfig := .Scratch.Get "cardConfig" }}
<div class="card">
<a href="{{ .RelPermalink }}">
    <li class="card-content">
        <div class="card-body">
        <h3 class="card-title">{{ .LinkTitle }}</h3>
        <p>{{ partial "card/date.html" . }}</p>
        {{ if $cardConfig.fullSummary }}
            {{ partial "card/full_summary.html" . }}
        {{ else }}
        <p>{{ .Summary }}</p>
        {{ end }}
        </div>

        {{ with .Resources.GetMatch .Params.thumbnail }}
            {{ $image := .Fit "800x500" }}
            <div>
            <img class="card-image" src="{{ $image.RelPermalink }}" alt="{{ .Name }}">
            </div>
        {{ else }}
            {{ with .Resources.GetMatch "thumbnail.*" }}
            {{ $image := .Fit "400x400" }}
            <div>
            <img class="card-image" src="{{ $image.RelPermalink }}" alt="{{ $image.Name }}">
            </div>
            {{ end }}
        {{ end }}
    </li>
</a>
{{ if $cardConfig.showMeta }}
    <hr>
    {{ with .Params.github }}
        {{ partial "links/github.html" . }}
    {{ end }}
    {{ with .Params.link }}
        {{ partial "links/link.html" . }}
    {{ end }}
    {{ with .Params.site }}
        {{ partial "links/site.html" . }}
    {{ end }}
    {{ $hasMetaAttrs := or $cardConfig.showCategories $cardConfig.showTags }}
    {{ if $hasMetaAttrs }}
    <div class="card-meta">
        {{ if $cardConfig.showCategories }}
            {{ partial "categories.html" . }}
        {{ end }}
        {{ if $cardConfig.showTags }}
            {{ partial "tags.html" . }}
        {{ end }}
    </div>
    {{ end }}
{{ end }}
</div>