From a43b353ca3e2d923ca8f0cdd1aeab70e5b1313a4 Mon Sep 17 00:00:00 2001 From: amzrk2 Date: Sat, 19 Sep 2020 14:15:35 +0800 Subject: new: lazyload image shortcodes --- layouts/shortcodes/img-lazy.html | 27 ++++--------------- layouts/shortcodes/img-nz-lazy.html | 54 ++++--------------------------------- layouts/shortcodes/img-nz.html | 10 +++---- 3 files changed, 14 insertions(+), 77 deletions(-) (limited to 'layouts') 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 }} -{{ index .Params 0 }} -{{ else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" }} -{{ index .Params 1 }} -{{ else if eq (index .Params 0) "col" }} -{{ index .Params 1 }} -{{ else }}{{ end }}{{ else }}{{ end }} +{{- if len .Params | eq 3 -}} +

+ {{ index .Params 1 }} +

+{{- end -}} \ No newline at end of file diff --git a/layouts/shortcodes/img-nz-lazy.html b/layouts/shortcodes/img-nz-lazy.html index 8a46329..bba88b6 100644 --- a/layouts/shortcodes/img-nz-lazy.html +++ b/layouts/shortcodes/img-nz-lazy.html @@ -1,49 +1,5 @@ -{{ if len .Params | eq 2 }} -{{ index .Params 0 }} -{{ else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" }} -{{ index .Params 1 }} -{{ else if eq (index .Params 0) "col" }} -{{ index .Params 1 }} -{{ else }} - - {{ index .Params 0 }} - -{{ end }}{{ else if len .Params | eq 4 }}{{ if eq (index .Params 0) "row" }} - - {{ index .Params 1 }} - -{{ else if eq (index .Params 0) "col" }} - - {{ index .Params 1 }} - -{{ else }}{{ end }}{{ else }}{{ end }} +{{- if len .Params | eq 3 -}} +

+ {{ index .Params 1 }} +

+{{- end -}} \ No newline at end of file diff --git a/layouts/shortcodes/img-nz.html b/layouts/shortcodes/img-nz.html index 2e4b3af..175dc5b 100644 --- a/layouts/shortcodes/img-nz.html +++ b/layouts/shortcodes/img-nz.html @@ -1,7 +1,5 @@ -{{ if (index .Params 2) }} - +{{- if len .Params | eq 2 -}} +

{{ index .Params 0 }} - -{{ else }} -{{ index .Params 0 }} -{{ end }} +

+{{- end -}} \ No newline at end of file -- cgit v1.2.3