summaryrefslogtreecommitdiffstats
path: root/layouts/shortcodes/img-lazy.html
diff options
context:
space:
mode:
authoramzrk22020-09-19 14:15:35 +0800
committeramzrk22020-09-19 14:15:35 +0800
commita43b353ca3e2d923ca8f0cdd1aeab70e5b1313a4 (patch)
treeb084c409a1ec2facb7230727bc0dd4e64e7df995 /layouts/shortcodes/img-lazy.html
parent93722cd7f5fb51408a36c941c2188a373d01209b (diff)
downloadhugo-theme-fuji-a43b353ca3e2d923ca8f0cdd1aeab70e5b1313a4.tar.gz
hugo-theme-fuji-a43b353ca3e2d923ca8f0cdd1aeab70e5b1313a4.tar.bz2
hugo-theme-fuji-a43b353ca3e2d923ca8f0cdd1aeab70e5b1313a4.zip
new: lazyload image shortcodes
Diffstat (limited to 'layouts/shortcodes/img-lazy.html')
-rw-r--r--layouts/shortcodes/img-lazy.html27
1 files changed, 5 insertions, 22 deletions
diff --git a/layouts/shortcodes/img-lazy.html b/layouts/shortcodes/img-lazy.html
index bac255b..eed9b0e 100644
--- a/layouts/shortcodes/img-lazy.html
+++ b/layouts/shortcodes/img-lazy.html
@@ -1,22 +1,5 @@
-{{ if len .Params | eq 2 }}
-<img
- class="lazyload img-zoomable"
- src="{{ .Site.Params.lazyPlaceholder | relURL }}"
- data-src="{{ index .Params 1 | relURL | safeURL }}"
- alt="{{ index .Params 0 }}"
-/>
-{{ else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" }}
-<img
- class="lazyload img-zoomable"
- src="{{ .Site.Params.lazyPlaceholderRow | relURL }}"
- data-src="{{ index .Params 2 | relURL | safeURL }}"
- alt="{{ index .Params 1 }}"
-/>
-{{ else if eq (index .Params 0) "col" }}
-<img
- class="lazyload img-zoomable"
- src="{{ .Site.Params.lazyPlaceholderCol | relURL }}"
- data-src="{{ index .Params 2 | relURL | safeURL }}"
- alt="{{ index .Params 1 }}"
-/>
-{{ else }}{{ end }}{{ else }}{{ end }}
+{{- if len .Params | eq 3 -}}
+<p><div class="image-wrapper ratio-{{ index .Params 0 }}">
+ <img class="lazyload img-zoomable" data-src="{{ index .Params 2 | relURL | safeURL }}" alt="{{ index .Params 1 }}" />
+</div></p>
+{{- end -}} \ No newline at end of file