summaryrefslogtreecommitdiff
path: root/layouts/partials/toc.html
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-08 21:30:23 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-08 21:30:23 +0800
commitbce6be90883b107285faa56acf0081b54daa3aa9 (patch)
tree0893f99b5debe074f1596b6cfc6d3c86da34ca42 /layouts/partials/toc.html
Initialize personal website
Diffstat (limited to 'layouts/partials/toc.html')
-rw-r--r--layouts/partials/toc.html7
1 files changed, 7 insertions, 0 deletions
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
new file mode 100644
index 0000000..4db9a6f
--- /dev/null
+++ b/layouts/partials/toc.html
@@ -0,0 +1,7 @@
+{{- $headings := findRE `<h[23][ >]` .Content -}}
+{{- if gt (len $headings) 4 }}
+ <section class="table-of-contents" aria-labelledby="contents-title">
+ <h2 id="contents-title">CONTENTS</h2>
+ {{ .TableOfContents }}
+ </section>
+{{- end -}}