summaryrefslogtreecommitdiff
path: root/layouts/_partials/items/post.html
blob: 5527ea6cf171c183c427f02e6c17181f0e4e6d15 (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
{{ $ctx := .ctx }}
{{ $showSummary := .showSummary }}
<div class="posts-item w-full my-2"
    style="view-transition-name: post-{{ .ctx.File.UniqueID }}">
    <header class="w-full md:flex md:justify-between">
        <div>
            <p class="font-mono text-secondary">
                <time>{{ .ctx.Date.Format "January 2" }},</time>
                <span>in <a href="/{{ .ctx.Section }}/">{{ .ctx.Section }}</a></span>
            </p>
            <h2 class="xerox"
                {{ if $showSummary }} style="margin-bottom: 0"{{ end }}>
                <a href="{{ .ctx.Permalink }}">
                    {{ if eq .ctx.Section "library" }}
                        读《{{ .ctx.Title }}》
                    {{ else }}
                        {{ .ctx.Title }}
                    {{ end }}
                </a>
                {{ if eq .ctx.Section "fictions" }}
                <span class="font-normal text-4 text-secondary">小说</span>
                {{ end }}
            </h2>
        </div>
        {{ with .ctx.Params.categories }}
        <div class="my-4">
            {{ partial "components/category-pill" $ctx }}
        </div>
        {{ end }}
    </header>
    {{ if or $showSummary .ctx.Params.description }}
    <div class="markdown-body text-size-lg leading-relaxed"
        style="view-transition-name: post-content-{{ .ctx.File.UniqueID }}">
        {{ if $showSummary }}
            {{ .ctx.Summary }}
        {{ else if .ctx.Params.description }}
            {{ .ctx.Params.description }}
        {{ end }}
    </div>
    {{ end }}
</div>