Skip to content

Add build-time image optimization - #39

Open
LJWatson wants to merge 1 commit into
mainfrom
improve-image-handling
Open

Add build-time image optimization#39
LJWatson wants to merge 1 commit into
mainfrom
improve-image-handling

Conversation

@LJWatson

Copy link
Copy Markdown
Owner

Summary

  • Replace raw <img> tags with a build-time {% image %} Nunjucks shortcode powered by @11ty/eleventy-img, generating responsive <picture> markup (WebP + original-format fallback, srcset/sizes, lazy loading)
  • Applied across the About page hero image, post.html's optional feature-image slot, and 12 inline images across 7 post files — several source images were 2–3.5MB with no responsive sizing
  • Alt text is enforced at build time (missing/empty alt fails the build); a { decorative: true } opt-in supports genuinely decorative images with alt=""
  • Documented the shortcode's usage, options, and behaviour in docs/NOTES.md

Test plan

  • npm run build succeeds with no errors
  • Generated <picture> markup verified directly (webp source, fallback img, correct width/height/alt)
  • Live browser check: WebP negotiation confirmed via network request, alt text confirmed via accessibility tree on About page and affected posts, at both mobile and desktop viewports
  • npx linkinator ./dist --recurse re-run — all new /images/optimized/... references return 200, no regressions
  • npm audit unchanged (no new vulnerabilities introduced)
  • Isolated test of the shortcode's alt-text enforcement and decorative-image opt-in, both paths verified directly

Replace raw <img> tags with a responsive @11ty/eleventy-img shortcode
(WebP + fallback picture markup, lazy loading, mandatory alt text with
an explicit decorative opt-in) across the About page, the post
feature-image slot, and 12 inline post images. Several source images
were several megabytes each with no responsive sizing, which this
fixes at build time with no runtime dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant