diff options
author | Matthew Lemon <y@yulqen.org> | 2023-10-23 13:17:55 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-10-23 13:17:55 +0100 |
commit | 4bcbdbc1c2480128b6c992c46597c977c7d57797 (patch) | |
tree | 82b401aa30184fa1ee05b7651720f199230691ad | |
parent | 4974bf7efe0a4428958679f6bdc7cc69dfc7291f (diff) |
wip: more on pagination - trying to understand .Scratch
-rw-r--r-- | content/stream/2022_08_14.md | 3 | ||||
-rw-r--r-- | layouts/shortcodes/streamimage.html | 6 | ||||
-rw-r--r-- | 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" >}} +<!-- {{< 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 }} -<img src="{{$scratch.Get "imgpath" }}/{{ $filename }}"> + +<!-- <p>{{ $.Page.Params.draft }}</p> --> +<p>{{ .Scratch.Get "toss" }}</p> +<img src="../../img/{{ $filename }}"> 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 }} <h3 id="{{ .Date.Format "Monday, 2 January 2006"| urlize}}">{{ .Date.Format "Monday, 2 January 2006" }}</h3> + +{{ $.Scratch.Set "toss" "toss" }} +<div style="margin-bottom: 1em;"> + {{ .Content }} +</div> + +{{ $.Scratch }} + {{ if $paginator.HasPrev }} <p>this page is paginated</p> + {{ $.Page.Scratch.Add "imgpath" "PAGINATED" }} {{ else }} <p>this page is NOT paginated</p> - {{ $.Scratch.Set "imgpath" "img/" }} + {{ $.Page.Scratch.Set "imgpath" "img/" }} {{ end }} -<div style="margin-bottom: 1em;"> - {{ .Content }} -</div> {{ if .Params.tags }} |