summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2023-10-23 15:05:16 +0100
committerMatthew Lemon <y@yulqen.org>2023-10-23 15:05:16 +0100
commitb970808bccebdbd102ef5f2337c74f3c2f99d1e9 (patch)
tree6d5f04ccffe154650e4fafd7419b370f67de25c6 /layouts
parent4bcbdbc1c2480128b6c992c46597c977c7d57797 (diff)
Pagination of stream complete with working images
To include an image in the stream, you have to use the streamimage shortcode, e.g. {{< streamimage filename="bobbins.jpg" >}} bobbins.jpg must be saved in content/stream/img. You can include a "size" param in the shortcode (a string as number), which is translated as a height attribute in the img html tag.
Diffstat (limited to 'layouts')
-rw-r--r--layouts/shortcodes/streamimage.html6
-rw-r--r--layouts/stream/list.html18
2 files changed, 9 insertions, 15 deletions
diff --git a/layouts/shortcodes/streamimage.html b/layouts/shortcodes/streamimage.html
index 2ff9f0a..003b982 100644
--- a/layouts/shortcodes/streamimage.html
+++ b/layouts/shortcodes/streamimage.html
@@ -1,5 +1,3 @@
{{ $filename := .Get "filename" }}
-
-<!-- <p>{{ $.Page.Params.draft }}</p> -->
-<p>{{ .Scratch.Get "toss" }}</p>
-<img src="../../img/{{ $filename }}">
+{{ $size := .Get "size" }}
+<img src="{{ absURL "/stream/img/" }}{{ $filename }}" height="{{ $size }}">
diff --git a/layouts/stream/list.html b/layouts/stream/list.html
index 2fb46b4..7f3a92f 100644
--- a/layouts/stream/list.html
+++ b/layouts/stream/list.html
@@ -12,21 +12,17 @@
<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>
- {{ $.Page.Scratch.Set "imgpath" "img/" }}
-{{ end }}
-
+<!-- {{ if $paginator.HasPrev }} -->
+<!-- <p>this page is paginated</p> -->
+<!-- {{ $.Page.Scratch.Add "imgpath" "PAGINATED" }} -->
+<!-- {{ else }} -->
+<!-- <p>this page is NOT paginated</p> -->
+<!-- {{ $.Page.Scratch.Set "imgpath" "img/" }} -->
+<!-- {{ end }} -->
{{ if .Params.tags }}