aboutsummaryrefslogtreecommitdiff
path: root/layouts/shortcodes/img.html
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2024-11-03 11:09:06 -0600
committerTimmy Keller <tjk@tjkeller.xyz>2024-11-03 11:09:06 -0600
commit609524f4e4213b1dbbb70fb70aa197616f3e8740 (patch)
tree670e44013aa1137fee11fb02085bd15e34f88bff /layouts/shortcodes/img.html
parentb2b833f447417e6eeab6f73327d6db915593f8ad (diff)
downloadhugo-theme-tjkbasic-609524f4e4213b1dbbb70fb70aa197616f3e8740.tar.xz
hugo-theme-tjkbasic-609524f4e4213b1dbbb70fb70aa197616f3e8740.zip
fix spacing around img shortcode
Diffstat (limited to 'layouts/shortcodes/img.html')
-rw-r--r--layouts/shortcodes/img.html42
1 files changed, 21 insertions, 21 deletions
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html
index 65ca44f..56bf22f 100644
--- a/layouts/shortcodes/img.html
+++ b/layouts/shortcodes/img.html
@@ -1,33 +1,33 @@
<!-- https://gohugo.io/content-management/image-processing/ -->
-
<!-- Get image -->
-{{ $image := resources.GetMatch (.Get "src") }}
+{{- $image := resources.GetMatch (.Get "src") -}}
<!-- Get parameters -->
-{{ $alt := .Get "alt" | default "" }}
-{{ $rotation := .Get "rotation" | default 0 }}
+{{- $alt := .Get "alt" | default "" -}}
+{{- $rotation := .Get "rotation" | default 0 -}}
<!-- Get quality -->
-{{ $quality := .Get "quality" | default "original" }}
-
-{{ $q := 0 }}
-{{ $size := 0 }}
-{{ if eq $quality "low" }}
- {{ $q = 60 }}
- {{ $size = 600 }}
-{{ else if eq $quality "medium" }}
- {{ $q = 75 }}
- {{ $size = 1000 }}
-{{ else if eq $quality "high" }}
- {{ $q = 90 }}
- {{ $size = 1200 }}
-{{ end }}
+{{- $quality := .Get "quality" | default "original" -}}
+<!-- Apply quality settings -->
+{{- $q := 0 -}}
+{{- $size := 0 -}}
+{{- if eq $quality "low" -}}
+ {{- $q = 60 -}}
+ {{- $size = 600 -}}
+{{- else if eq $quality "medium" -}}
+ {{- $q = 75 -}}
+ {{- $size = 1000 -}}
+{{- else if eq $quality "high" -}}
+ {{- $q = 90 -}}
+ {{- $size = 1200 -}}
+{{- end -}}
<!-- Make image -->
-{{ if ne $quality "original" }}
- {{ $image = $image.Resize (printf "%dx q%d r%d" $size $q $rotation) }}
-{{ end }}
+{{- if ne $quality "original" -}}
+ {{- $image = $image.Resize (printf "%dx q%d r%d" $size $q $rotation) -}}
+{{- end -}}
+
<figure>
<img src="{{ $image.RelPermalink }}" title="{{ $alt }}" alt="{{ $alt }}" />
<figcaption>{{ $alt }}</figcaption>