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

github.com/zwbetz-gh/cupper-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/toc.html')
-rw-r--r--layouts/partials/toc.html19
1 files changed, 3 insertions, 16 deletions
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
index 55a2ccb..cdb0d7c 100644
--- a/layouts/partials/toc.html
+++ b/layouts/partials/toc.html
@@ -1,19 +1,6 @@
-{{ $headings := findRE "<h2.*?>(.|\n])+?</h2>" .Content }}
-{{ if ge (len $headings) 2 }}
+{{ if eq .Params.toc true }}
<nav class="toc" aria-labelledby="toc-heading">
- <h2 id="toc-heading">{{ T "table_of_contents" }}</h2>
- <ol>
- {{ range $headings }}
- <li>
- {{ $id := findRE "id=\".*\"" . }}
- {{ $id = index $id 0 }}
- {{ $id = strings.TrimPrefix "id=\"" $id }}
- {{ $id = strings.TrimSuffix "\"" $id }}
- <a href="#{{ $id }}">
- {{ . | htmlUnescape | plainify }}
- </a>
- </li>
- {{ end }}
- </ol>
+ <strong id="toc-heading">{{ T "table_of_contents" }}</strong>
+ {{ .TableOfContents }}
</nav>
{{ end }}