Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/asurbernardo/amperage.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsur <asur@asurbernardo.com>2020-04-25 16:17:21 +0300
committerAsur <asur@asurbernardo.com>2020-04-25 16:17:21 +0300
commit844884a9496e83e03450f22e3c4eab951c425cf9 (patch)
treef1de5f11d7526dbac53945a9fc4788b90e6cdea3
parent70922be05921644558d117324674104b69264935 (diff)
Use automatic srcset on the product card
-rw-r--r--layouts/partials/blocks/image.html6
-rw-r--r--layouts/partials/shortcodes/product.html6
2 files changed, 5 insertions, 7 deletions
diff --git a/layouts/partials/blocks/image.html b/layouts/partials/blocks/image.html
index b7af217..c923e86 100644
--- a/layouts/partials/blocks/image.html
+++ b/layouts/partials/blocks/image.html
@@ -9,11 +9,13 @@
{{ if and (eq .ResourceType "image") (ne .MediaType.SubType "svg") }}
<amp-img
src="{{ .Permalink | absURL }}"
- srcset="{{ (.Resize "1200x").Permalink }} 1200w,
+ srcset="
+ {{ (.Resize "1200x").Permalink }} 1200w,
{{ (.Resize "800x").Permalink }} 800w,
{{ (.Resize "640x").Permalink }} 640w,
{{ (.Resize "480x").Permalink }} 480w,
- {{ (.Resize "320x").Permalink }} 320w"
+ {{ (.Resize "320x").Permalink }} 320w
+ "
width={{ with $.width }} "{{ . }}" {{ else }} {{ .Width }} {{ end }}
height={{ with $.height }} "{{ . }}" {{ else }} {{ .Height }} {{ end }}
layout={{ with $.layout }}"{{ . }}"{{else}}"responsive"{{ end }}
diff --git a/layouts/partials/shortcodes/product.html b/layouts/partials/shortcodes/product.html
index e8e3296..75355fa 100644
--- a/layouts/partials/shortcodes/product.html
+++ b/layouts/partials/shortcodes/product.html
@@ -1,11 +1,7 @@
<div class="product">
{{ $resource := resources.Get .image }}
{{ with $resource }}
- <amp-img
- class="product__image"
- layout="responsive" width="300" height="300"
- alt="{{ $.title }}"
- src="{{ .Permalink | absURL }}"></amp-img>
+ {{ partial "blocks/image.html" (dict "src" $.image "alt" $.title "width" 300 "height" 300 "class" "product__image") }}
{{ else }}
<amp-img
class="product__image"