Skip to content

fix(seo): map zh-CN locale to zh for OG image filenames#244

Open
evan188199-tech wants to merge 1 commit into
Snouzy:mainfrom
evan188199-tech:fix/og-image-zh-CN-filename-mapping
Open

fix(seo): map zh-CN locale to zh for OG image filenames#244
evan188199-tech wants to merge 1 commit into
Snouzy:mainfrom
evan188199-tech:fix/og-image-zh-CN-filename-mapping

Conversation

@evan188199-tech

Copy link
Copy Markdown

What

The home page's OpenGraph / Twitter card image was broken for the zh-CN locale, because page.tsx and two spots in structured-data.ts interpolated the raw locale into the filename (default-og-image_zh-CN.jpg) while the actual file is 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 default-og-image_zh-CN.jpgdoesn't exist. The codebase already handles this mismatch in 5 other places (locale === "zh-CN" ? "zh" : locale):

  • app/[locale]/layout.tsx:157
  • src/components/seo/SEOHead.tsx:49,183
  • src/shared/lib/structured-data.ts:269

…but misses it in:

  • app/[locale]/(app)/page.tsx:34,44 (home page metadata)
  • src/shared/lib/structured-data.ts:219,250 (structured data)

Fix

Apply the same zh-CNzh mapping in all 4 missed spots.

Fixes #243.

The OG image file is named default-og-image_zh.jpg, but page.tsx and two
spots in structured-data.ts interpolated the raw locale into the filename,
producing default-og-image_zh-CN.jpg for the zh-CN locale — a file that
doesn't exist, so the home page's social card image was broken for Chinese
users. The codebase already applies the zh-CN → zh mapping in 5 other
places (layout.tsx, SEOHead.tsx, structured-data.ts:269); apply it here too.

Fixes Snouzy#243
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Workoutcool Team Team on Vercel.

A member of the Team first needs to authorize it.

@evan188199-tech

Copy link
Copy Markdown
Author

此 PR 由 GLM-5.2 修复。

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.

Bug: Home page OG/Twitter image broken for zh-CN locale (missing zh-CN→zh filename mapping)

1 participant