From 6efb50a01079fb0a93bb9a51d31278d6673178e0 Mon Sep 17 00:00:00 2001 From: Helder Pereira Date: Wed, 25 Aug 2021 09:05:36 +0100 Subject: [PATCH] Add menu-pre and menu-post templates --- exampleSite/content/basics/_index.en.md | 3 +-- exampleSite/content/cont/_index.en.md | 3 +-- exampleSite/content/shortcodes/_index.en.md | 3 +-- exampleSite/layouts/partials/menu-pre.html | 1 + layouts/partials/menu-post.html | 1 + layouts/partials/menu-pre.html | 1 + layouts/partials/menu.html | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 exampleSite/layouts/partials/menu-pre.html create mode 100644 layouts/partials/menu-post.html create mode 100644 layouts/partials/menu-pre.html diff --git a/exampleSite/content/basics/_index.en.md b/exampleSite/content/basics/_index.en.md index 2c23f2e19a..4d67f9be71 100755 --- a/exampleSite/content/basics/_index.en.md +++ b/exampleSite/content/basics/_index.en.md @@ -1,8 +1,7 @@ +++ chapter = true -pre = "1. " title = "Basics" -weight = 5 +weight = 1 +++ ### Chapter 1 diff --git a/exampleSite/content/cont/_index.en.md b/exampleSite/content/cont/_index.en.md index a9c47579b9..c0152a656e 100755 --- a/exampleSite/content/cont/_index.en.md +++ b/exampleSite/content/cont/_index.en.md @@ -1,8 +1,7 @@ +++ chapter = true -pre = "2. " title = "Content" -weight = 10 +weight = 2 +++ ### Chapter 2 diff --git a/exampleSite/content/shortcodes/_index.en.md b/exampleSite/content/shortcodes/_index.en.md index 6abfbba967..b1ed46b27d 100644 --- a/exampleSite/content/shortcodes/_index.en.md +++ b/exampleSite/content/shortcodes/_index.en.md @@ -1,8 +1,7 @@ +++ chapter = true -pre = "3. " title = "Shortcodes" -weight = 15 +weight = 3 +++ ### Chapter 3 diff --git a/exampleSite/layouts/partials/menu-pre.html b/exampleSite/layouts/partials/menu-pre.html new file mode 100644 index 0000000000..2d5bac8e6a --- /dev/null +++ b/exampleSite/layouts/partials/menu-pre.html @@ -0,0 +1 @@ +{{ if .Params.chapter }}{{ .Params.weight }}. {{ end }} diff --git a/layouts/partials/menu-post.html b/layouts/partials/menu-post.html new file mode 100644 index 0000000000..3062681dc3 --- /dev/null +++ b/layouts/partials/menu-post.html @@ -0,0 +1 @@ +{{ .Params.Post | safeHTML }} diff --git a/layouts/partials/menu-pre.html b/layouts/partials/menu-pre.html new file mode 100644 index 0000000000..e4a2aaac7b --- /dev/null +++ b/layouts/partials/menu-pre.html @@ -0,0 +1 @@ +{{ .Params.Pre | safeHTML }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index af81f02543..9c56e08bdd 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -110,7 +110,7 @@ {{ $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
  • - {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}} + {{ partial "menu-pre.html" . }}{{or .Params.menuTitle .LinkTitle .Title}}{{ partial "menu-post.html" . }} {{ if $showvisitedlinks}}{{end}} {{ $numberOfPages := (add (len ( where .Pages "Params.hidden" "ne" true )) (len ( where .Sections "Params.hidden" "ne" true ))) }} @@ -143,7 +143,7 @@ {{else if not .Params.Hidden }}
  • - {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}} + {{ partial "menu-pre.html" . }}{{or .Params.menuTitle .LinkTitle .Title}}{{ partial "menu-post.html" . }} {{ if $showvisitedlinks}}{{end}}