Bug: Home page OG/Twitter image broken for zh-CN locale (missing zh-CN→zh filename mapping)
Bug
The home page generates a broken OpenGraph / Twitter card image for the zh-CN locale, because page.tsx interpolates the raw locale into the filename (default-og-image_zh-CN.jpg) while the actual file is named default-og-image_zh.jpg.
Root cause
app/[locale]/(app)/page.tsx (lines 34, 44):
url: `${getServerUrl()}/images/default-og-image_${locale}.jpg`,For locale === "zh-CN" this produces /images/default-og-image_zh-CN.jpg, which does not exist (only default-og-image_zh.jpg is shipped).
The codebase already knows about this mismatch and applies a zh-CN → zh mapping in 5 other places:
app/[locale]/layout.tsx:157—locale === "zh-CN" ? "zh" : localesrc/components/seo/SEOHead.tsx:49,183— same mappingsrc/shared/lib/structured-data.ts:269— same mapping
… but misses it in:
app/[locale]/(app)/page.tsx:34,44(home page metadata)src/shared/lib/structured-data.ts:219,250(structured data image)
Impact
When a Chinese-locale home page URL is shared on social media (Twitter, Facebook, Slack, etc.), the OG/Twitter card shows a broken image. The other Chinese pages work fine (they use the mapped path), so it's specifically the home page that's affected.
Fix
Apply the same zh-CN → zh mapping that the rest of the codebase uses:
const ogImageLocale = locale === "zh-CN" ? "zh" : locale;
// ...
url: `${getServerUrl()}/images/default-og-image_${ogImageLocale}.jpg`,I have a PR ready (fixing page.tsx + the two structured-data.ts misses).
Source: Snouzy/workout-cool