From 589ef2040d0e32a57731c8d0dcfe1c5864608372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 30 Oct 2023 07:31:21 +0100 Subject: [PATCH] toc: simplify user-defined toc generation #705 dry out too much duplication in the theme --- exampleSite/layouts/partials/toc-content.html | 4 ++ exampleSite/layouts/partials/toc.html | 51 ------------------- layouts/partials/toc-content.html | 1 + layouts/partials/toc.html | 2 +- 4 files changed, 6 insertions(+), 52 deletions(-) create mode 100644 exampleSite/layouts/partials/toc-content.html delete mode 100644 exampleSite/layouts/partials/toc.html create mode 100644 layouts/partials/toc-content.html diff --git a/exampleSite/layouts/partials/toc-content.html b/exampleSite/layouts/partials/toc-content.html new file mode 100644 index 0000000000..c8e8aedaa7 --- /dev/null +++ b/exampleSite/layouts/partials/toc-content.html @@ -0,0 +1,4 @@ +{{- partial "shortcodes/piratify.html" (dict + "page" . + "pagefield" "TableOfContents" +) }} \ No newline at end of file diff --git a/exampleSite/layouts/partials/toc.html b/exampleSite/layouts/partials/toc.html deleted file mode 100644 index 98ed13321f..0000000000 --- a/exampleSite/layouts/partials/toc.html +++ /dev/null @@ -1,51 +0,0 @@ -{{- if eq .Kind "taxonomy" }} - -{{- else if eq .Kind "term" }} - -{{- else }} - {{- partial "shortcodes/piratify.html" (dict - "page" . - "pagefield" "TableOfContents" - ) }} -{{- end }} \ No newline at end of file diff --git a/layouts/partials/toc-content.html b/layouts/partials/toc-content.html new file mode 100644 index 0000000000..1ce61ba7d0 --- /dev/null +++ b/layouts/partials/toc-content.html @@ -0,0 +1 @@ +{{- .TableOfContents }} \ No newline at end of file diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 9b6ec5311b..a9cb73d13e 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -44,5 +44,5 @@ {{- else }} - {{- .TableOfContents }} + {{- partial "toc-content.html" . }} {{- end }} \ No newline at end of file