summaryrefslogtreecommitdiffstats
path: root/layouts/partials/sidebar-toc.html
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-07-24 23:46:23 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-07-24 23:46:23 +0200
commit283662fb44a19c6ab7a8f14b510506edd8c02950 (patch)
treed21090f848ef71c02875dd23bbf4532a2aa074c4 /layouts/partials/sidebar-toc.html
parent07818f368f7a6f1dec65c51e733867c1a5adabb3 (diff)
downloadgohugo-theme-ed-283662fb44a19c6ab7a8f14b510506edd8c02950.tar.gz
Allow disable hypothesis on custom pages
Diffstat (limited to 'layouts/partials/sidebar-toc.html')
-rw-r--r--layouts/partials/sidebar-toc.html10
1 files changed, 10 insertions, 0 deletions
diff --git a/layouts/partials/sidebar-toc.html b/layouts/partials/sidebar-toc.html
index 9361aab..a6ac8d3 100644
--- a/layouts/partials/sidebar-toc.html
+++ b/layouts/partials/sidebar-toc.html
@@ -9,10 +9,20 @@
{{ $toc := .Page.TableOfContents }}
{{ $home := printf `<a class="sidebar-nav-item" href="%s">%s</a>` site.Home.RelPermalink (i18n "home") | safeHTML }}
+ {{ $annotation := "" }}
+
+ {{ if ne .Params.annotations false }}
+ {{ $annotation = (partial "hypothesis.html" .) }}
+ {{ end }}
{{ $toc = $toc | replaceRE `id="TableOfContents"` `class="sidebar-nav"` | safeHTML }}
{{ $toc = $toc | replaceRE "(<[/]?ul>|<[/]?ol>|<[/]?li>)" "" | safeHTML }}
{{ $toc = $toc | replaceRE `<a href="(.*)">(.*)</a>` `<a class="sidebar-nav-item sidebar-nav-item-toc" href="$1">$2</a>` | safeHTML }}
+
+ {{ if ne .Params.annotations false }}
+ {{ $toc = $toc | replaceRE `<nav class="sidebar-nav">` (printf `<nav class="sidebar-nav">%s` $annotation) | safeHTML }}
+ {{ end }}
+
{{ $toc = $toc | replaceRE `<nav class="sidebar-nav">` (printf `<nav class="sidebar-nav">%s` $home) | safeHTML }}
{{ $toc }}