From 81e7de06a73c9a4c22363b89628e49f3ba8e4d8f Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Wed, 26 Mar 2025 12:21:19 -0700 Subject: [PATCH] TOC: Render TOC only for current page --- layouts/partials/sidebar-list-pages.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/layouts/partials/sidebar-list-pages.html b/layouts/partials/sidebar-list-pages.html index e35a147..1fa864e 100644 --- a/layouts/partials/sidebar-list-pages.html +++ b/layouts/partials/sidebar-list-pages.html @@ -20,9 +20,11 @@ {{ end }} {{ .Title }} - {{- with .TableOfContents -}} - {{- . -}} - {{- end -}} + {{ if eq $currentUrl .Permalink }} + {{- with .TableOfContents -}} + {{- . -}} + {{- end -}} + {{ end }} {{ end }} {{ end }}