about summary refs log tree commit diff
path: root/layouts/partials/toc.html
blob: 3b5a822cbde665ce73adb366a2bfc0e2c1eb2931 (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
{{ $chapters := .content.Page.Pages }}
{{ $currentLink := .currentLink}}
{{ range .Page.Translations }}
{{ $chapters = $chapters | lang.Merge .Pages }}
{{ end}}
<ol>
  {{ range sort $chapters "Weight" }}
  <li>
    {{ $fullTitle := .Title }}
    {{ with .Params.chapterName }}
      {{ $fullTitle = printf "%s – %s" $fullTitle . }}
    {{ end }}
    {{ if eq $currentLink .RelPermalink }}
      <a aria-current="page">{{ trim $fullTitle " " }}</a> ({{ i18n "current"}})
    {{ else }}
      <a href="{{ .RelPermalink }}">{{ trim $fullTitle " " }}</a>
    {{ end }}
    {{ partial "post-info.html" . }}
    {{ if .IsSection}}
      {{ partial "toc.html" (dict "content" . "currentLink" $currentLink) }}
    {{ end }}
  </li>
  {{ end }}
</ol>