aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/toc.html
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-08-08 21:30:23 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-08-08 21:30:23 +0800
commit4a5238e28715cc5a462f020b04d0f1226c972d90 (patch)
tree0893f99b5debe074f1596b6cfc6d3c86da34ca42 /layouts/partials/toc.html
downloadrhomepage-4a5238e28715cc5a462f020b04d0f1226c972d90.tar.gz
rhomepage-4a5238e28715cc5a462f020b04d0f1226c972d90.tar.xz
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 -}}