fix(www): optimize blog author avatar loading - #1908
Conversation
Serve avatars from avatars.githubusercontent.com (no redirect), enable next/image optimization instead of unoptimized, and raise remote image cache TTL so PFPs do not cold-fetch on every render. Co-authored-by: Yam Borodetsky <hi@yam.codes>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes
- Avatar host swap —
getAuthorAvatarUrlnow targetsavatars.githubusercontent.com/{handle}?s={size}instead ofgithub.com/{handle}.png, verified to return200directly rather than ano-cache302, with the JSDoc updated to match. - Blog index avatar — drops
unoptimizedand addssizes="20px"so Next optimizes and caches the 20px thumbnail. - Blog post avatar — drops
unoptimized, addssizes="32px"andpriorityon both the linked and unlinked variants. images.minimumCacheTTL— raised to 31 days (2678400s) innext.config.ts;remotePatternsalready allowed both hosts, so no pattern change was needed.- Unit test — expected URL in
blog-author.test.tsupdated to the new host/query format.
ℹ️ Nitpicks
- The
github.comentry inimages.remotePatternsis now unused bynext/image— only the two blog call sites referencedgithub.com/{user}.png, and both now useavatars.githubusercontent.com. Dropping it would tighten the allowlist.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Use next/image `preload` instead of deprecated `priority`, drop the site-wide 31-day minimumCacheTTL, and remove the unused github.com remotePatterns entry. Co-authored-by: Yam Borodetsky <hi@yam.codes>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Addressed prior feedback — commit
4910e78responds to all three prior findings: both post-avatarpriorityprops swapped topreload, the site-wideminimumCacheTTL: 31 daysremoved, and the now-unusedgithub.comremotePatternsentry dropped. preloadis the correct Next 16 API — verified against the pinnednext@16.2.6;priorityis marked deprecated in favor ofpreloadinget-img-props.d.ts, and both[slug]/page.tsxvariants (:79,:90) now use it. Only one renders per request, so there is no double-preload.github.comremoval is safe — the only remaininggithub.comreferences inapps/wwware linkhrefs (header/star buttons, author profile link), notnext/imagesources, so tightening the allowlist toavatars.githubusercontent.combreaks nothing.- Cache behavior — dropping
minimumCacheTTLreturns optimized images to Next's default TTL, which avoids masking in-place replacements of local/assets/*files while still caching the avatars.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Summary
Blog author profile pictures were slow on every render because they:
github.com/{user}.png, which 302s toavatars.githubusercontent.comwithCache-Control: no-cachenext/imagewithunoptimized, so Next never cached or resized themChanges
avatars.githubusercontent.com/{handle}?s={size}(direct 200, no redirect)unoptimized)sizes/preloadon post avatars (Next.js 16; not deprecatedpriority)avatars.githubusercontent.cominimages.remotePatternsReview follow-ups
priority→preloadminimumCacheTTL: 31 days(risky for local/assets/*)github.comremote patternTest plan
getAuthorAvatarUrl/blogand a post; confirm avatars come from/_next/image?...