summaryrefslogtreecommitdiff
path: root/layouts/section.html
blob: 444e52d37ac1184dc20619a8391378bf03c738a6 (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
53
54
55
56
{{ define "main" }}

    {{ $pages := .Pages }}
    {{ $categories := slice }}

    <article>
      {{ partial "header.html" . }}
      {{ partial "home/home-nav" . }}
      <div class="posts-list pagefind-exclude">
        <div class="markdown-body">{{ .Content }}</div>

        {{ partial "section-categories" $pages }}
        <p class="text-secondary text-sm">*稻草人周刊也属于散文集,但为了方便查阅,周刊没有列在下面,请到<a href="/categories/稻草人周刊/">分类页面</a>查看周刊。</p>

        <!-- Post Archive List -->
        {{ $remainingMonthsToOpen := 3 }}
        {{ range $pages.GroupByDate "2006" -}}
          <section class="w-full">
            {{ partial "components/section-title" (dict
                "Left" .Key
                "Right" (T "archivePage.postCountAnnual" (len .Pages))
            )}}

            {{ range .Pages.GroupByDate "January" }}
            <div class="posts-month-archive"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}>
                <h2 class="text-size-lg inline-block w-full m-0
                    flex justify-between items-center">
                    {{ .Key }}
                </h2>
                <ul class="ps-0 flex flex-col gap-2 list-none leading-relaxed">
                    {{ range .Pages }}
                    {{ $isWeekly := (eq .Params.categories "稻草人周刊") }}
                    {{ if not (eq .Params.categories "稻草人周刊") }}
                    <li class="flex gap-4 text-size-lg">
                        <span class="text-size-xs h-5 font-mono text-secondary flex-shrink-0
                            inline-block border-1 border-solid border-t-5 px-1
                            border-neutral-200 dark:border-neutral-700">
                            {{ .Date.Format "02" }}
                        </span>
                        <a href="{{ .RelPermalink }}">
                            {{ .Title }}{{ with .Params.subtitle }}:<span class="text-secondary">{{. }}</span>
                            {{ end }}
                        </a>
                    </li>
                    {{ end }}
                    {{ end }}
                </ul>
            </div>
            {{ $remainingMonthsToOpen = sub $remainingMonthsToOpen 1 }}
            {{ end }}
          </section>
        {{ end }}
      </div>
    </article>
    {{ partial "footer.html" . }}
{{ end }}