diff options
Diffstat (limited to 'layouts/partials/funcs/toc_from_pages.html')
-rw-r--r-- | layouts/partials/funcs/toc_from_pages.html | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/layouts/partials/funcs/toc_from_pages.html b/layouts/partials/funcs/toc_from_pages.html index 1317b74..456f8a6 100644 --- a/layouts/partials/funcs/toc_from_pages.html +++ b/layouts/partials/funcs/toc_from_pages.html @@ -40,6 +40,9 @@ {{ $h2s = $h2s | append $tocItem }} {{ $h3s = slice }} {{ end }} + {{ if eq $previousLevel 2 }} + {{ $h2s = $h2s | append $previousH2 }} + {{ end }} {{ $previousH2 = $item }} {{ else }} {{ $h3s = $h3s | append $item }} @@ -50,6 +53,9 @@ {{ end }} {{ if ne $previousLevel 0 }} + {{ $tocItem := merge $previousH2 (dict "sub" $h3s) }} + {{ $h2s = $h2s | append $tocItem }} + {{ $item := merge $previousH1 (dict "sub" $h2s) }} {{ $toc = $toc | append $item }} {{ end }} |