Skip to content

Fix broken og:image links from old shared og-image URLs - #4973

Merged
Duncanma merged 4 commits into
mainfrom
restore-og-image-png-fallback
Jul 27, 2026
Merged

Fix broken og:image links from old shared og-image URLs#4973
Duncanma merged 4 commits into
mainfrom
restore-og-image-png-fallback

Conversation

@Duncanma

@Duncanma Duncanma commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restores static/img/assets/open-graph-shiny.png at the same path/filename it used to live at. PR Performance review, mostly removing dead/unused code #4945 replaced the site default image with a .jpg and deleted the .png, so old shared links (Slack, etc.) that cached the .png URL now 404 and show a broken image. Resized to the current 1200x630 crop and palette-compressed (5.6MB -> 95KB) instead of restoring the original oversized file. The active default in docusaurus.config.js is untouched — still the .jpg.
  • Adds a vercel.json rewrite so any /img/og/* path that isn't a real file falls back to the site default image instead of 404ing. Generated card paths are content-hash based (title + description + TEMPLATE_VERSION), so editing a page's title/description — or bumping TEMPLATE_VERSION for a design change — orphans the old hash's file, breaking any previously-shared link to it the same way. This is a general safety net for that whole class of problem, not just the one asset in this PR.

Test plan

  • Fresh yarn build; confirmed generated cards and both default images exist in build/
  • bin/validate-og-images.js and bin/check-og-build-budget.js pass
  • Verified the rewrite locally using serve-handler (the routing library behind Vercel's own serve CLI) against real build output: existing /img/og/* cards serve byte-identical to source, a nonexistent hash falls back to the default image, unrelated paths (the restored .png, a normal doc page) are unaffected
  • Confirm on the Vercel preview deployment for this PR (serve-handler isn't Vercel's actual production router, so this is the authoritative check)

Valid URL: good image (should show the right custom image)
Invalid URL: bad image (should show the default)

🤖 Generated with Claude Code

┆Attachments: EDU-6817 Fix broken og:image links from old shared og-image URLs

Duncanma added 2 commits July 27, 2026 10:10
PR #4945 replaced this file with a .jpg and removed the .png, but old
shared links (Slack, etc.) that cached the .png URL now 404 and show
a broken image. Restoring it at the same path/filename fixes those
without changing the current default (docusaurus.config.js still
points at the .jpg). Resized to match the current 1200x630 crop and
palette-compressed (5.6MB -> 95KB) instead of restoring the original
oversized file.
Generated card paths under /img/og/ are content-hash based (title +
description + TEMPLATE_VERSION). When a page's title/description
changes, or TEMPLATE_VERSION bumps, the old hash's file simply stops
being produced by the next build/deploy, so any previously-shared
link pointing at it 404s.

This rewrite makes any /img/og/* path that isn't a real file on disk
fall back to the site default image instead of a broken image. Vercel
serves real static files first and only applies a rewrite when
nothing matches, so this never affects a currently-valid card - only
orphaned hashes.

Verified locally with serve-handler (the routing library Vercel's own
`serve` CLI uses) against a real `yarn build` output: existing hashes
are served untouched byte-for-byte, a nonexistent hash falls back to
the default image, and unrelated paths (pages, the restored legacy
.png) are unaffected.
@Duncanma
Duncanma requested a review from a team as a code owner July 27, 2026 17:31
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview, Comment Jul 27, 2026 6:41pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

This PR does not change any pages in /docs. If you make updates, links to the modified pages will appear here.

@Duncanma
Duncanma merged commit 5f1373b into main Jul 27, 2026
11 checks passed
@Duncanma
Duncanma deleted the restore-og-image-png-fallback branch July 27, 2026 18:46
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.

2 participants