From d6f2b2b9fd1243ae35cc61840bfbad16dda24309 Mon Sep 17 00:00:00 2001 From: stanislas Date: Sat, 22 Mar 2025 00:38:11 +0100 Subject: [PATCH] Personnalisation du bandeau de pagination --- layouts/a-propos.html | 14 ++++++++++ layouts/partials/pagination.html | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 layouts/a-propos.html create mode 100644 layouts/partials/pagination.html diff --git a/layouts/a-propos.html b/layouts/a-propos.html new file mode 100644 index 0000000..0531e30 --- /dev/null +++ b/layouts/a-propos.html @@ -0,0 +1,14 @@ +{{ define "main" }} +{{- if .Site.Home.Content -}} +{{- .Site.Home.Content -}} +{{- partial "edit-meta.html" . -}} +{{- else -}} +

Customize your own home page

+

The site is working. Don't forget to customize this homepage with your own. You typically have 2 choices :

+
    +
  1. Create an _index.md document in content folder and fill it with Markdown content
  2. +
  3. Create an index.html file in the static folder and fill the file with HTML content
  4. +
  5. Configure your server to automatically redirect home page to one your documentation page
  6. +
+{{- end -}} +{{- end -}} diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..e18e476 --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,44 @@ +{{- $currentNode := . -}} + + +{{- define "pagination" -}} +{{- $currentNode := .currentnode -}} +{{- $menu_exclusion := .menu_exclusion -}} + +{{- if hasPrefix $currentNode.Permalink .menu.Permalink -}} + {{- $currentNode.Scratch.Set "NextPageOK" "OK" -}} + {{- if .menu.IsHome -}} + {{- $currentNode.Scratch.Set "prevPage" "" -}} + {{- else -}} + {{- $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") -}} + {{- end -}} +{{- else -}} + {{- if eq ($currentNode.Scratch.Get "NextPageOK") "OK" -}} + {{- $currentNode.Scratch.Set "NextPageOK" nil -}} + {{ if in $menu_exclusion .menu.Section }} + {{- else -}} + {{- $currentNode.Scratch.Set "nextPage" .menu -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{- $currentNode.Scratch.Set "prevPageTmp" .menu -}} +{{- $currentNode.Scratch.Set "pages" .menu.Pages -}} +{{- if .menu.IsHome -}} + {{- $currentNode.Scratch.Set "pages" .menu.Sections -}} +{{- else if .menu.Sections -}} + {{- $currentNode.Scratch.Set "pages" (.menu.Pages | union .menu.Sections) -}} +{{- end -}} +{{- $pages := ($currentNode.Scratch.Get "pages") -}} +{{- range $pages.ByWeight -}} + {{- template "pagination" dict "menu" . "currentnode" $currentNode "menu_exclusion" $menu_exclusion -}} +{{- end -}} +{{- end -}}