about summary refs log tree commit diff
path: root/layouts/_default/list.html
blob: bdcd630818aa8d346fddee52c88b8fcb3c6dc109 (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
{{/*
SPDX-FileCopyrightText: 2022 Ngô Ngọc Đức Huy <huyngo@disroot.org>

SPDX-License-Identifier: MIT
*/}}

{{ define "main" }}
  <section class="index-content">
    {{ .Content }}
  </section>
  {{ if in .Params.categories "book" }}
  {{ $chapters := .Page.Pages }}
  {{ range .Page.Translations }}
    {{ $chapters = $chapters | lang.Merge .Pages }}
  {{ end}}
  <section class="toc">
    <ol>
      {{ range sort $chapters "Weight" }}
      <li>
        <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
        {{ partial "post-info.html" . }}
      </li>
      {{ end }}
    <ol>
  </section>
  {{ else if in .Params.categories "blog" }}
  <section class="feed">
    <ol reversed>
      {{ range sort .Pages "Date" "desc" }}
      <li>
        <time datetime="{{ .Date }}">{{ .Date.Format "2006-01-02" }}</time>:
        <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
        {{ partial "post-language-switcher.html" . }}
        {{ partial "post-info.html" . }}
      </li>
      {{ end }}
    <ol>
  </section>
  {{ else }}
  <section class="list">
    <ul>
      {{ range sort .Pages "Date" }}
      <li>
        <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
        {{ partial "post-language-switcher.html" . }}
        {{ partial "post-info.html" . }}
      </li>
      {{ end }}
    <ul>
  </section>
  {{ end }}
{{ end }}