summaryrefslogtreecommitdiff
path: root/layouts/_partials/items/post.html
blob: 3e426c564626289f5ac1d47e453144a1537eda7b (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
{{ $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="/{{ .Section }}/">{{ .ctx.Section }}</a></span>
            </p>
            <h2 class="xerox"
                {{ if $showSummary }} style="margin-bottom: 0"{{ end }}>
                <a
                    href="{{ .ctx.Permalink }}"
                    data-umami-event="🏠 Click post link from index"
                >
                    {{ if eq .ctx.Section "library" }}
                        读《{{ .ctx.Title }}》
                    {{ else }}
                        {{ .ctx.Title }}
                    {{ end }}
                </a>
                {{ if eq .ctx.Section "fictions" }}
                <span class="font-normal text-4 text-[var(--secondary-text-color)]">小说</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!"
        style="view-transition-name: post-content-{{ .File.UniqueID }}">
        {{ if $showSummary }}
            {{ .ctx.Summary }}
        {{ else if .ctx.Params.description }}
            {{ .ctx.Params.description }}
        {{ end }}
    </div>
    {{ end }}
</div>