From 879ec47668c2b2e995818cbc88c3ce248d5df62a Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Mon, 14 Sep 2026 01:56:42 +0800 Subject: Support loose notes and nested series --- layouts/notes/list.html | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/layouts/notes/list.html b/layouts/notes/list.html index e45a039..a8411e1 100644 --- a/layouts/notes/list.html +++ b/layouts/notes/list.html @@ -28,9 +28,38 @@ {{- end }} {{- else }} - {{- with .RegularPages.ByWeight }} -
-

ARTICLES

+ {{/* + 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

+
    + {{- range . }} +
  • {{ .LinkTitle }}
  • + {{- end }} +
+
+ {{- end }} + {{- with $chapters }} +
+

CHAPTERS

    {{- range $index, $page := . }}
  1. @@ -45,14 +74,11 @@ {{- with .Sections.ByWeight }}

    SUBSERIES

    -
      - {{- range $index, $series := . }} -
    1. - {{ printf "%02d" (add $index 1) }} - {{ $series.LinkTitle }}/{{ with $series.Params.description }} — {{ . }}{{ end }} -
    2. +
        + {{- range . }} +
      • {{ .LinkTitle }}/{{ with .Params.description }} — {{ . }}{{ end }}
      • {{- end }} -
    +
    {{- end }} {{- end }} -- cgit v1.2.3