From 61cf3194699cacb6393a5c2b0a211546815aa068 Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Thu, 11 Jan 2024 18:16:11 +0000
Subject: [PATCH] remove duplicate toc ids #131

---
 layouts/partials/sidebar.html |    3 ++-
 exampleSite/go.mod            |    2 +-
 exampleSite/go.sum            |    2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/exampleSite/go.mod b/exampleSite/go.mod
index c62a3cf..15833e7 100644
--- a/exampleSite/go.mod
+++ b/exampleSite/go.mod
@@ -2,4 +2,4 @@
 
 go 1.19
 
-require github.com/onweru/compose v0.0.0-20240111174942-cdf2ef5f4da1 // indirect
+require github.com/onweru/compose v0.0.0-20240111175353-5392252575a2 // indirect
diff --git a/exampleSite/go.sum b/exampleSite/go.sum
index bd0227e..f51271e 100644
--- a/exampleSite/go.sum
+++ b/exampleSite/go.sum
@@ -16,3 +16,5 @@
 github.com/onweru/compose v0.0.0-20230823103345-61fa78130dec/go.mod h1:2eSBLsKzvKf3r4/vHiKdakIBqDtWACDAqAD7tRdt00o=
 github.com/onweru/compose v0.0.0-20240111174942-cdf2ef5f4da1 h1:evqwOllx6XwfmYG2NKGFmfloNQXazxOCPir914Myjpk=
 github.com/onweru/compose v0.0.0-20240111174942-cdf2ef5f4da1/go.mod h1:2eSBLsKzvKf3r4/vHiKdakIBqDtWACDAqAD7tRdt00o=
+github.com/onweru/compose v0.0.0-20240111175353-5392252575a2 h1:jqoBc1FPDJNxRrrieLlRvyKCumTLa5XkehgXz3yBdvE=
+github.com/onweru/compose v0.0.0-20240111175353-5392252575a2/go.mod h1:2eSBLsKzvKf3r4/vHiKdakIBqDtWACDAqAD7tRdt00o=
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index 94d8cba..9c1e6b0 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -15,8 +15,9 @@
         {{- range . }}
         {{- if .IsPage }}
         <h3 class="section_link{{ if eq .RelPermalink $permalink }} active{{ end }}"><a id="docs-{{ anchorize .Title }}" href="{{ .Permalink }}">{{ .Title }}</a></h3>
+        {{ $toc_id := printf "toc-%s" (replace (urlize .Title) "." "-") }}
         {{- if ne (print .TableOfContents) ""}}
-          {{- .TableOfContents }}
+          {{-  safeHTML (replace .TableOfContents "TableOfContents" $toc_id) }}
         {{- end }}
         {{- else }}
         {{- template "tree" (dict "page" $page "section" .) }}

--
Gitblit v1.10.0