diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html index d7c0c10..acb26e8 100644 --- a/layouts/shortcodes/image.html +++ b/layouts/shortcodes/image.html @@ -1,5 +1,7 @@ - - + {{ if (fileExists (printf "%s/%s" "static" (replace (index .Params "src") (path.Ext (index .Params "src")) ".webp"))) -}} + + {{- end }} + {{ index .Params \ No newline at end of file diff --git a/layouts/shortcodes/smallimg.html b/layouts/shortcodes/smallimg.html index 4cae5b7..3610345 100644 --- a/layouts/shortcodes/smallimg.html +++ b/layouts/shortcodes/smallimg.html @@ -1,11 +1,17 @@ -{{ index .Params \ No newline at end of file + + {{ if (fileExists (printf "%s/%s" "static" (replace (index .Params "src") (path.Ext (index .Params "src")) ".webp"))) -}} + + {{- end }} + + {{ index .Params + \ No newline at end of file