From a26557f25a3b09e7ad322bdb576c787258300985 Mon Sep 17 00:00:00 2001 From: Varun A P Date: Fri, 18 Jun 2021 21:22:30 +0200 Subject: [PATCH 1/3] Add Paginator --- exampleSite/config.toml | 1 + layouts/index.html | 92 ++++++++++++++++++++++++++--------------- 2 files changed, 60 insertions(+), 33 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a9fafb0..422954c 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -14,6 +14,7 @@ pluralizelisttitles = false description = "Minimal, one page, theme for showcasing your work" message = "" hideAutoMenu = false + paginate = 2 [[menu.main]] name = "External" diff --git a/layouts/index.html b/layouts/index.html index a5e21fb..641675c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -4,42 +4,68 @@
{{- partial "custom-message.html" . -}} -
- {{ range where .Site.Pages "Kind" "page" }} - {{ if ne .Params.Exclude true }} - -
- {{ if (or .Params.Image .CurrentSection.Params.Image) }} - {{ .Title }} +
+ {{ $pages := where .Site.Pages "Kind" "page" }} + + {{ $paginator := .Paginate (where $pages ".Params.exclude" "!=" "true") .Site.Params.paginate }} + + + + {{ if gt $paginator.TotalPages 1 }} +
- - {{ end }} + {{ range $paginator.Pagers }} + {{ if eq . $paginator }} +
  • {{ .PageNumber }}
  • + {{ else }} +
  • {{ .PageNumber }}
  • + {{ end }} + {{ end }} + + {{ if $paginator.HasNext }} +
  • + {{ end }} + + {{ end }}
    +
    From b716c54a9dc21d49e066b9e6007eee56df3b343b Mon Sep 17 00:00:00 2001 From: Varun A P Date: Sat, 19 Jun 2021 08:51:16 +0200 Subject: [PATCH 2/3] Multipage sections --- layouts/_default/section.html | 72 +++++++++++++++++++++++++++++++++++ layouts/partials/footer.html | 12 ++++-- layouts/partials/header.html | 4 +- 3 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 layouts/_default/section.html diff --git a/layouts/_default/section.html b/layouts/_default/section.html new file mode 100644 index 0000000..8a5f090 --- /dev/null +++ b/layouts/_default/section.html @@ -0,0 +1,72 @@ +{{ define "main" }} + +
    +
    + {{- partial "custom-message.html" . -}} + +
    + {{ $pages := where .Paginator.Pages "Kind" "page" }} + + {{ $paginator := .Paginate (where $pages ".Params.exclude" "!=" "true") .Site.Params.paginate }} + + + + {{ if gt $paginator.TotalPages 1 }} + + {{ end }} +
    + +
    +
    + +{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 6d8475a..39d8c7f 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -84,6 +84,12 @@