{{ define "main" }} {{- $isNotesRoot := .Parent.IsHome -}}

{{ .Title }}

{{ partial "document-view.html" . }}
{{ .Content }} {{- if $isNotesRoot }} {{- with .RegularPages.ByTitle }}

STANDALONE NOTES

{{- end }} {{- with .Sections.ByWeight }}

SERIES

{{- end }} {{- else }} {{/* A section is a container by default. A direct page becomes an ordered chapter only when it declares `series`; all other direct pages remain ordinary, unnumbered articles. Child sections are listed as subseries and are rendered by this same template, so the hierarchy can be nested to any depth. */}} {{- $articles := slice -}} {{- $chapters := slice -}} {{- range .RegularPages.ByTitle }} {{- if not .Params.series }} {{- $articles = $articles | append . -}} {{- end }} {{- end }} {{- range .RegularPages.ByWeight }} {{- if .Params.series }} {{- $chapters = $chapters | append . -}} {{- end }} {{- end }} {{- with $articles }}

ARTICLES

{{- end }} {{- with $chapters }}

CHAPTERS

    {{- range $index, $page := . }}
  1. {{ printf "%02d" (add $index 1) }} {{ $page.LinkTitle }} updated {{ time.Format "2006-01-02" $page.Params.updated }}
  2. {{- end }}
{{- end }} {{- with .Sections.ByWeight }}

SUBSERIES

{{- end }} {{- end }}
{{ end }}