better img shortcode -> lazy option default true

This commit is contained in:
zzossig 2020-02-27 23:00:36 +09:00
parent c4ab5ffeb0
commit 0ee469442a
1 changed files with 1 additions and 1 deletions

View File

@ -1,5 +1,5 @@
{{ $base := (findRE "/[a-zA-Z0-9_]+/" .Site.BaseURL | default "/") }}
{{ if not (.Get "lazy") }}
{{ if or (eq (.Get "lazy") false) (eq (.Get "lazy") "false") }}
<figure {{ with .Get "class" }}class="{{ . }}" {{ end }}>
{{ with .Get "link"}}<a href="{{ . }}">{{ end }}
<img src="{{ if eq $base "/" }}{{ .Get "src" }}{{ else }}{{ delimit $base "" }}{{ substr (.Get "src") 1 }}{{ end }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} style="width:{{ .Get "width" }};height:{{ .Get "height" }};"/>