diff options
author | Matthew Lemon <y@yulqen.org> | 2023-10-22 20:23:00 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-10-22 20:23:00 +0100 |
commit | f1dbc28426a61bd8a5c38e4b3ad11ec190071f8b (patch) | |
tree | 815a43741bb41e01111d8b06fae5ba65421c6c81 | |
parent | 0476dd3e7923b1cf7061093d782bd94718900b8c (diff) |
Stream pagination now basically working with 10 items on each page
-rw-r--r-- | config.toml | 2 | ||||
-rw-r--r-- | layouts/stream/list.html | 47 |
2 files changed, 34 insertions, 15 deletions
diff --git a/config.toml b/config.toml index 42e4ff3..d51482c 100644 --- a/config.toml +++ b/config.toml @@ -5,7 +5,7 @@ languageCode = "en-gb" enableInlineShortcodes = true pygmentsCodeFences = true pygmentsUseClasses = true -paginate = 2 +paginate = 10 [params] description = "An intentionally quiet and unassuming (and empty) blog" diff --git a/layouts/stream/list.html b/layouts/stream/list.html index 4b384d8..39c2b1e 100644 --- a/layouts/stream/list.html +++ b/layouts/stream/list.html @@ -2,26 +2,45 @@ {{ .Content }} -{{ range (.Paginate (where site.RegularPages "Section" "stream")).Pages }} +{{ $paginator := .Paginate (where site.RegularPages "Section" "stream") }} + +{{ range $paginator.Pages }} + <h3 id="{{ .Date.Format "Monday, 2 January 2006"| urlize}}">{{ .Date.Format "Monday, 2 January 2006" }}</h3> - {{ .Content }} +{{ .Content }} - {{ if .Params.tags }} - <div style="background-color: rgb(240, 240, 240);"> +{{ if .Params.tags }} +<div style="background-color: rgb(240, 240, 240);"> This post is tagged with: - {{ range .Params.tags }} - <a href="{{ "tags" | absURL }}/{{ . | urlize }}">{{ . }}</a> - {{ end }} - {{ else }} + {{ range .Params.tags }} + <a href="{{ "tags" | absURL }}/{{ . | urlize }}">{{ . }}</a> + {{ end }} + {{ else }} <div style="background-color: rgb(240, 240, 240); margin-top: 20px;"> - This post is untagged. + This post is untagged. </div> - {{ end }} - </div> - <span><small><a href="{{ "stream" | absURL }}/#{{ .Date.Format "Monday 2 January 2006" | urlize}}">permalink</a></small></span> + {{ end }} +</div> +<span><small><a href="{{ "stream" | absURL }}/#{{ .Date.Format "Monday 2 January 2006" | urlize}}">permalink</a></small></span> + +<hr class="new1"> +{{ end }} + +<p>Stream navigation:</p> - <hr class="new1"> - {{ end }} +{{ if $paginator.HasPrev }} + <a href="{{ $paginator.Prev.URL }}">←</a> +{{ end }} + + +{{ range $paginator.Pagers }} + <a href="{{ .URL }}">{{ .PageNumber }}</a> +{{ end }} + +{{ if $paginator.HasNext}} + <a href="{{ $paginator.Next.URL }}">→</a> +{{ end }} + {{ end }} |