b3b9fb7ac6
Hugo Extended site with 426 cocktail recipes from the open cocktail dataset. Dark amber/gold editorial aesthetic, Tailwind CSS v4, Alpine.js client-side search and filtering, HTMX page transitions, Docker + nginx production build. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
856 B
HTML
27 lines
856 B
HTML
{{/*
|
|
Usage:
|
|
{{ partial "img.html" (dict "res" $imgResource "widths" (slice 600 1200) "sizes" "100vw" "class" "w-full h-full object-cover" "alt" "cocktail name" "loading" "lazy") }}
|
|
*/}}
|
|
{{- $res := .res -}}
|
|
{{- $widths := .widths | default (slice 800 1200) -}}
|
|
{{- $sizes := .sizes | default "100vw" -}}
|
|
{{- $class := .class | default "" -}}
|
|
{{- $alt := .alt | default "" -}}
|
|
{{- $loading := .loading | default "lazy" -}}
|
|
|
|
{{- $entries := slice -}}
|
|
{{- range $widths -}}
|
|
{{- $img := $res.Resize (printf "%dx webp" .) -}}
|
|
{{- $entries = $entries | append (printf "%s %dw" $img.RelPermalink .) -}}
|
|
{{- end -}}
|
|
|
|
<img
|
|
srcset="{{ delimit $entries ", " }}"
|
|
sizes="{{ $sizes }}"
|
|
src="{{ ($res.Resize (printf "%dx webp" (index $widths 0))).RelPermalink }}"
|
|
alt="{{ $alt }}"
|
|
loading="{{ $loading }}"
|
|
decoding="async"
|
|
class="{{ $class }}"
|
|
/>
|