aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicholasjohnson.ch>2023-08-25 00:00:00 +0000
committerNicholas Johnson <nick@nicholasjohnson.ch>2023-08-25 00:00:00 +0000
commita5872bf7d2f849f645dd41b85a06c4983f4cb5bc30a2d1a716338471fea7fdcd (patch)
tree6fedf1fbb46df1ecc71364c761622485b3e7a5e07082819509acb60d6beb3c02 /layouts
parent706dd4517813a9f6275509732d45aee06eed7dbf133cd2b8f457179971ed69ab (diff)
downloadhugo-theme-journal-a5872bf7d2f849f645dd41b85a06c4983f4cb5bc30a2d1a716338471fea7fdcd.tar.gz
hugo-theme-journal-a5872bf7d2f849f645dd41b85a06c4983f4cb5bc30a2d1a716338471fea7fdcd.zip
Simplify link reference printing logic
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.gmi18
1 files changed, 4 insertions, 14 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi
index e0361d8..8dc150b 100644
--- a/layouts/_default/single.gmi
+++ b/layouts/_default/single.gmi
@@ -79,29 +79,19 @@
{{ $refs := $scratch.Get "refs" -}}
{{ if and (.Page.Params.makerefs | default true) $refs -}}
-{{ $ref_index := 0 -}}
-{{ $refsMinusOne := sub (len $refs) 1 }}
+{{ $ref_index := 0 }}
## {{ i18n "refs" }}
-
-{{ range first $refsMinusOne $refs -}}
+{{ range $refs -}}
{{ $ref_index = add $ref_index 1 -}}
{{ $ref_text := index . 1 -}}
{{ $ref_link := index . 2 -}}
{{ $ref_title := index . 3 -}}
- {{/* render referenced links */ -}}
-{{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML }}
-{{ end -}}
-
-{{ range last 1 $refs -}}
- {{ $ref_index = add $ref_index 1 -}}
- {{ $ref_text := index . 1 -}}
- {{ $ref_link := index . 2 -}}
- {{ $ref_title := index . 3 -}}
- {{/* render referenced link */ -}}
+ {{/* render referenced links */}}
{{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML -}}
{{ end -}}
+
{{ end -}}
{{ end }}