summaryrefslogtreecommitdiff
path: root/layouts/_partials/posts/comment.html
blob: 90757781359aab5d1d494878527d4613487e531e (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
<!--
    Giscus has been abandoned since 2026-01-30,
    old data from GitHub Discussion and some other comment systems
    has been exported to `data/gicus.json`
    They are rendered here if found.
-->
{{ $cutoffDate := time.AsTime "2026-01-30" }}
{{ if .Params.Date.Before $cutoffDate }}
    {{ $giscusData := hugo.Data.giscus }}
    {{ $pageTitle := .Title }}
    {{ range $giscusData }}
        {{ if eq .title $pageTitle }}
            {{ $url := .url }}
            {{ with .comments.nodes }}
            <details>
                <summary class="text-size-sm text-secondary cursor-pointer">博客的评论区已经被禁用,旧的数据已经导出,可以点击这行字查看。</summary>
                <div class="my-4">
                    {{ range . }}
                        <div class="text-md py-4 px-1">
                            <div class="mb-4 flex justify-between">
                                <span class="font-bold">{{ .author.login }}</span>
                                <span class="text-secondary">{{ .createdAt | time.Format "2006/01/02" }}</span>
                            </div>
                            <div>
                                {{ .body | markdownify }}
                            </div>
                        </div>
                    {{ end }}
                </div>
                {{ with $url }}
                    <p><a href="{{ . }}" class="small-button" target="_blank">Full GitHub Discussion →</a></p>
                {{ end }}
                <hr />
            </details>
            {{ end }}
        {{ end }}
    {{ end }}
{{ end }}