Improve image and smallimg support of webp
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<picture>
|
||||
<source srcset="{{ replace (index .Params "src") (path.Ext (index .Params "src")) ".webp" | absURL }}" type="image/webp">
|
||||
<source srcset="{{ index .Params "src" | absURL }}">
|
||||
{{ if (fileExists (printf "%s/%s" "static" (replace (index .Params "src") (path.Ext (index .Params "src")) ".webp"))) -}}
|
||||
<source srcset="{{ replace (index .Params "src") (path.Ext (index .Params "src")) ".webp" | absURL }}" type="image/webp">
|
||||
{{- end }}
|
||||
<source srcset="{{ index .Params "src" | absURL }}">
|
||||
<img src="{{ index .Params "src" | absURL }}" {{ if isset .Params "alt" -}} alt="{{ index .Params "alt"}}" {{- end }}>
|
||||
</picture>
|
||||
Reference in New Issue
Block a user