{{ define "main" }} {{ $soldOut := eq (printf "%v" .Params.sold_out) "true" }}{{ $cur := .Params.currency }}{{ $base := .Params.price }}
{{ with index .Site.Lists .Collection }}

{{ .Title }}

{{ end }}
{{/* The big photo, and a small one for each photo under it. Picking a small one (a click, or the arrow keys) shows it big; no script. */}}
{{ with .Params.photos }}
{{ range $i, $p := . }}
{{ if eq $i 0 }}{{ picture $p.image $p.alt "(min-width: 760px) 55vw, 100vw" "class=product-photo-main fetchpriority=high" }}{{ else }}{{ picture $p.image $p.alt "(min-width: 760px) 55vw, 100vw" "class=product-photo-main loading=lazy" }}{{ end }}
{{ end }}
{{ if gt (len .) 1 }}
{{ range $i, $p := . }}{{ end }}
{{ end }} {{ end }}

{{ .Title }}

{{ with .Params.price }}

{{ if eq (printf "%v" $.Params.price_from) "true" }}From {{ end }}{{ money . $cur }}

{{ end }} {{ with .Summary }}

{{ . }}

{{ end }} {{ if $soldOut }}

Sold out

{{ else if .Params.variants }} {{ $vs := .Params.variants }} {{ with .Params.checkout }} {{/* One form: choose a size or color, and Buy sends it to the checkout. */}} {{ $field := default "products" .field }}{{ $item := default "{id}" .item }}
{{ range $k, $v := .fields }}{{ end }} {{ if eq (len $vs) 1 }}{{ with index $vs 0 }} {{ with .name }}{{ if ne . "One size" }}

{{ with (index $vs 0).group }}{{ . }} · {{ end }}{{ . }}

{{ end }}{{ end }} {{ end }}{{ else }} {{ if (index $vs 0).group }}{{/* Colors: the picker script turns this on; then only the chosen one's sizes and photos show. */}}{{ variantPicker }} {{ end }} {{ $g := "-" }} {{ range $i, $v := $vs }}{{ $vg := default "" $v.group }}{{ if ne $vg $g }}{{ if ne $i 0 }}
{{ end }}{{ $g = $vg }}
{{ if $vg }}{{ $vg }}{{ else }}{{ default "Choose one" $.Params.choose }}{{ end }}
{{ end }} {{ $sold := eq (printf "%v" $v.sold_out) "true" }} {{ end }}
{{ end }}
{{ if cartOn }}{{ end }}
{{ else }} {{/* No checkout form: each size or color is a Buy link of its own. */}}
{{ range $vs }}{{ if eq (printf "%v" .sold_out) "true" }}{{ with .group }}{{ . }} · {{ end }}{{ .name }} · sold out{{ else }}{{ with .group }}{{ . }} · {{ end }}{{ .name }}{{ with .price }} · {{ money . $cur }}{{ end }}{{ end }}{{ end }}
{{ end }}

You'll pay on our payment provider's secure page.

{{ else }}
{{ with .Params.buy }}{{ default "Buy" $.Params.button }}{{ end }} {{ range .Params.options }}{{ .name }}{{ with .price }} · {{ money . $cur }}{{ end }}{{ end }}

You'll pay on our payment provider's secure page.

{{ end }}
{{ with .Content }}
{{ . }}
{{ end }}
{{ end }}