36767c3d4d
Add layouts/partials/img.html helper that resizes and converts any Hugo page-resource image to WebP, emitting a responsive srcset at multiple widths. Wire it up to every image rendering site: - post-card.html: thumbnail (600w/1000w) + avatar (64px WebP) - post-card-large.html: featured card background (800w/1200w) - posts/single.html: banner (1200w/1800w, eager) + gallery (800w/1200w) - author-card.html: avatar (96px WebP, 2× retina) Result: banner.png 7.9 MB → 496 KB WebP at 1800w (−94 %). Hugo caches processed images in resources/_gen/ across builds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25 lines
1.2 KiB
HTML
25 lines
1.2 KiB
HTML
{{- /* Inline author byline for post single pages.
|
|
Expects the author page as context (.).
|
|
*/ -}}
|
|
<div class="flex items-center gap-4 py-6 border-t border-b border-zinc my-8">
|
|
{{- $avatarRes := .Resources.GetMatch "avatar.*" -}}
|
|
{{- if $avatarRes -}}
|
|
{{- $av := $avatarRes.Resize "96x webp" -}}
|
|
<a href="{{ $.RelPermalink }}" class="flex-shrink-0">
|
|
<img src="{{ $av.RelPermalink }}" alt="{{ $.Params.name | default $.Title }}" class="w-12 h-12 object-cover border border-zinc hover:border-heat transition-colors" width="{{ $av.Width }}" height="{{ $av.Height }}" loading="lazy" decoding="async">
|
|
</a>
|
|
{{- else -}}{{- with .Params.avatar -}}
|
|
<a href="{{ $.RelPermalink }}" class="flex-shrink-0">
|
|
<img src="{{ . }}" alt="{{ $.Params.name | default $.Title }}" class="w-12 h-12 object-cover border border-zinc hover:border-heat transition-colors" loading="lazy" decoding="async">
|
|
</a>
|
|
{{- end -}}{{- end -}}
|
|
<div class="min-w-0">
|
|
<a href="{{ .RelPermalink }}" class="label text-heat hover:text-frost transition-colors block mb-1">
|
|
{{ .Params.name | default .Title }}
|
|
</a>
|
|
{{- with .Params.bio -}}
|
|
<p class="text-fog text-sm leading-relaxed line-clamp-2 font-body">{{ . }}</p>
|
|
{{- end -}}
|
|
</div>
|
|
</div>
|