Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bep/docuapi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-04-04 22:03:10 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-04-04 22:03:10 +0300
commitf23027c5f61b320a6c3d4f1c5423ca6e5ff2f87b (patch)
treeb6bfd53b7385952d01527105f38f11e310088009
parent0ecdc45fc2a12f9d60b8478177873bac3bc22259 (diff)
Render content from oldest firstuniqid-rev
To get stable IDs.
-rw-r--r--layouts/_default/list.html79
1 files changed, 45 insertions, 34 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 23cb596..ee32bbe 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,41 +1,52 @@
{{ define "main" }}
- {{ range .Site.RegularPages }}
- {{ .Content }}
- {{ end }}
+ {{ range .Site.RegularPages.ByWeight.Reverse }}
+ {{ $tmp := .Content }}
+ {{ end }}
+ {{ range .Site.RegularPages }}
+ {{ .Content }}
+ {{ end }}
{{ end }}
{{ define "toc" }}
- <ul id="toc" class="toc-list-h1">
- {{ $maxDepth := 0 }}
- {{ with $.Site.Params.maxMenuDepth }}
- {{ $maxDepth = . }}
- {{ else }}
- {{ $maxDepth = 2 }}
- {{ end }}
- {{ $headers := slice }}
- {{ with .Site.RegularPages }}
- {{ $headers = partial "funcs/toc_from_pages" . }}
- {{ end }}
- {{ range $headers }}
- <li>
- <a href="#{{ .id }}" class="toc-h{{ .level }} toc-link" data-title="{{ .title }}">{{ .title }}</a>
- {{ if and (ge $maxDepth 2) .sub }}
- <ul class="toc-list-h2">
- {{ range .sub }}
- <li>
- <a href="#{{ .id }}" class="toc-h{{ .level }} toc-link" data-title="{{ .title }}">{{ .title }}</a>
- {{ if and (ge $maxDepth 3) .sub }}
- <ul class="toc-list-h3">
- {{ range .sub }}
- <li><a href="#{{ .id }}" class="toc-h{{ .level }} toc-link" data-title="{{ .title }}">{{ .title }}</a></li>
- {{ end }}
- </ul>
- {{ end }}
- </li>
- {{ end }}
- </ul>
+ <ul id="toc" class="toc-list-h1">
+ {{ $maxDepth := 0 }}
+ {{ with $.Site.Params.maxMenuDepth }}
+ {{ $maxDepth = . }}
+ {{ else }}
+ {{ $maxDepth = 2 }}
+ {{ end }}
+ {{ $headers := slice }}
+ {{ with .Site.RegularPages }}
+ {{ $headers = partial "funcs/toc_from_pages" . }}
+ {{ end }}
+ {{ range $headers }}
+ <li>
+ <a href="#{{ .id }}" class="toc-h{{ .level }} toc-link" data-title="{{ .title }}">
+ {{ .title }}
+ </a>
+ {{ if and (ge $maxDepth 2) .sub }}
+ <ul class="toc-list-h2">
+ {{ range .sub }}
+ <li>
+ <a href="#{{ .id }}" class="toc-h{{ .level }} toc-link" data-title="{{ .title }}">
+ {{ .title }}
+ </a>
+ {{ if and (ge $maxDepth 3) .sub }}
+ <ul class="toc-list-h3">
+ {{ range .sub }}
+ <li>
+ <a href="#{{ .id }}" class="toc-h{{ .level }} toc-link" data-title="{{ .title }}">
+ {{ .title }}
+ </a>
+ </li>
+ {{ end }}
+ </ul>
{{ end }}
- </li>
+ </li>
+ {{ end }}
+ </ul>
{{ end }}
- </ul>
+ </li>
+ {{ end }}
+ </ul>
{{ end }}