From ddc5948be59d70091bb813374d6e29ae5bf6564a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 21 Sep 2026 05:51:29 +0000 Subject: [PATCH 1/2] fix(www): optimize blog author avatar loading 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 --- apps/www/app/(home)/blog/[slug]/page.tsx | 6 ++++-- apps/www/app/(home)/blog/page.tsx | 2 +- apps/www/lib/blog-author.test.ts | 2 +- apps/www/lib/blog-author.ts | 8 ++++++-- apps/www/next.config.ts | 3 +++ 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/www/app/(home)/blog/[slug]/page.tsx b/apps/www/app/(home)/blog/[slug]/page.tsx index a9734b5a9..703ee6fb5 100644 --- a/apps/www/app/(home)/blog/[slug]/page.tsx +++ b/apps/www/app/(home)/blog/[slug]/page.tsx @@ -74,8 +74,9 @@ export default async function BlogPostPage(props: { alt={page.data.author} width={32} height={32} + sizes="32px" className="blog-page__avatar" - unoptimized + priority /> ) : ( @@ -84,8 +85,9 @@ export default async function BlogPostPage(props: { alt={page.data.author} width={32} height={32} + sizes="32px" className="blog-page__avatar" - unoptimized + priority /> ) ) : null} diff --git a/apps/www/app/(home)/blog/page.tsx b/apps/www/app/(home)/blog/page.tsx index e66d41424..8848109c9 100644 --- a/apps/www/app/(home)/blog/page.tsx +++ b/apps/www/app/(home)/blog/page.tsx @@ -70,8 +70,8 @@ export default function BlogIndexPage() { alt="" width={20} height={20} + sizes="20px" className="blog-page__avatar blog-page__avatar--sm" - unoptimized /> ) : null} {page.data.author} diff --git a/apps/www/lib/blog-author.test.ts b/apps/www/lib/blog-author.test.ts index 97201bfb5..2108225e9 100644 --- a/apps/www/lib/blog-author.test.ts +++ b/apps/www/lib/blog-author.test.ts @@ -22,7 +22,7 @@ describe("blog-author", () => { it("generates avatar url", () => { expect(getAuthorAvatarUrl("yamcodes", 32)).toBe( - "https://github.com/yamcodes.png?size=32", + "https://avatars.githubusercontent.com/yamcodes?s=32", ); }); }); diff --git a/apps/www/lib/blog-author.ts b/apps/www/lib/blog-author.ts index bd71d72d2..d0a3c388b 100644 --- a/apps/www/lib/blog-author.ts +++ b/apps/www/lib/blog-author.ts @@ -22,8 +22,12 @@ export function getAuthorGithub( } /** - * Returns a direct GitHub avatar image URL. + * Returns a direct GitHub avatar image URL (no redirect). + * + * Prefer `avatars.githubusercontent.com` over `github.com/{user}.png`, which + * 302s with `Cache-Control: no-cache` and forces a cold fetch on every render + * when `next/image` is marked `unoptimized`. */ export function getAuthorAvatarUrl(githubHandle: string, size = 64): string { - return `https://github.com/${githubHandle}.png?size=${size}`; + return `https://avatars.githubusercontent.com/${githubHandle}?s=${size}`; } diff --git a/apps/www/next.config.ts b/apps/www/next.config.ts index 6b628e36a..25bf1f73b 100644 --- a/apps/www/next.config.ts +++ b/apps/www/next.config.ts @@ -12,6 +12,9 @@ import { const config = { outputFileTracingRoot: path.join(__dirname, "../../"), images: { + // Blog author PFPs are tiny and change rarely; cache optimized + // variants longer than the default so repeat visits stay fast. + minimumCacheTTL: 60 * 60 * 24 * 31, remotePatterns: [ { protocol: "https", From 4910e7823ee91ab2e9a830b36c8c150cebf80cdc Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 21 Sep 2026 06:07:37 +0000 Subject: [PATCH 2/2] fix(www): address avatar optimization review feedback 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 --- apps/www/app/(home)/blog/[slug]/page.tsx | 4 ++-- apps/www/next.config.ts | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/www/app/(home)/blog/[slug]/page.tsx b/apps/www/app/(home)/blog/[slug]/page.tsx index 703ee6fb5..662939ebb 100644 --- a/apps/www/app/(home)/blog/[slug]/page.tsx +++ b/apps/www/app/(home)/blog/[slug]/page.tsx @@ -76,7 +76,7 @@ export default async function BlogPostPage(props: { height={32} sizes="32px" className="blog-page__avatar" - priority + preload /> ) : ( @@ -87,7 +87,7 @@ export default async function BlogPostPage(props: { height={32} sizes="32px" className="blog-page__avatar" - priority + preload /> ) ) : null} diff --git a/apps/www/next.config.ts b/apps/www/next.config.ts index 25bf1f73b..8da6a9dd9 100644 --- a/apps/www/next.config.ts +++ b/apps/www/next.config.ts @@ -12,14 +12,7 @@ import { const config = { outputFileTracingRoot: path.join(__dirname, "../../"), images: { - // Blog author PFPs are tiny and change rarely; cache optimized - // variants longer than the default so repeat visits stay fast. - minimumCacheTTL: 60 * 60 * 24 * 31, remotePatterns: [ - { - protocol: "https", - hostname: "github.com", - }, { protocol: "https", hostname: "avatars.githubusercontent.com",