From 4bcbdbc1c2480128b6c992c46597c977c7d57797 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 23 Oct 2023 13:17:55 +0100 Subject: wip: more on pagination - trying to understand .Scratch --- content/stream/2022_08_14.md | 3 ++- layouts/shortcodes/streamimage.html | 6 ++++-- layouts/stream/list.html | 17 +++++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/content/stream/2022_08_14.md b/content/stream/2022_08_14.md index 0606bd5..3db85e5 100644 --- a/content/stream/2022_08_14.md +++ b/content/stream/2022_08_14.md @@ -5,7 +5,8 @@ draft: false tags: ['berwick-upon-tweed', 'music'] --- -{{< figure src="img/swimmer_medal_border.png" alt="Grinning swimmer holding medal" >}} + +{{< streamimage filename="swimmer_medal_border.png" >}} I've had enough of BBC coverage of the European Championships (and latterly the Commonwealth Games). Too much positivity for my liking, it wears you down eventually. diff --git a/layouts/shortcodes/streamimage.html b/layouts/shortcodes/streamimage.html index eb5d468..2ff9f0a 100644 --- a/layouts/shortcodes/streamimage.html +++ b/layouts/shortcodes/streamimage.html @@ -1,3 +1,5 @@ {{ $filename := .Get "filename" }} -{{ $scratch := .Scratch }} - + + +

{{ .Scratch.Get "toss" }}

+ diff --git a/layouts/stream/list.html b/layouts/stream/list.html index 127d2eb..2fb46b4 100644 --- a/layouts/stream/list.html +++ b/layouts/stream/list.html @@ -1,23 +1,32 @@ {{ define "main" }} + {{ .Content }} + {{ $paginator := .Paginate (where site.RegularPages "Section" "stream") }} + {{ range $paginator.Pages }}

{{ .Date.Format "Monday, 2 January 2006" }}

+ +{{ $.Scratch.Set "toss" "toss" }} +
+ {{ .Content }} +
+ +{{ $.Scratch }} + {{ if $paginator.HasPrev }}

this page is paginated

+ {{ $.Page.Scratch.Add "imgpath" "PAGINATED" }} {{ else }}

this page is NOT paginated

- {{ $.Scratch.Set "imgpath" "img/" }} + {{ $.Page.Scratch.Set "imgpath" "img/" }} {{ end }} -
- {{ .Content }} -
{{ if .Params.tags }} -- cgit v1.2.3