Fix broken og:image links from old shared og-image URLs - #4973
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📖 Docs PR preview linksThis PR does not change any pages in /docs. If you make updates, links to the modified pages will appear here. |
Duncanma
enabled auto-merge (squash)
July 27, 2026 18:42
jsundai
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
static/img/assets/open-graph-shiny.pngat 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.jpgand deleted the.png, so old shared links (Slack, etc.) that cached the.pngURL 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 indocusaurus.config.jsis untouched — still the.jpg.vercel.jsonrewrite 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 bumpingTEMPLATE_VERSIONfor 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
yarn build; confirmed generated cards and both default images exist inbuild/bin/validate-og-images.jsandbin/check-og-build-budget.jspassserve-handler(the routing library behind Vercel's ownserveCLI) 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 unaffectedValid URL:
(should show the right custom image)
(should show the default)
Invalid URL:
🤖 Generated with Claude Code
┆Attachments: EDU-6817 Fix broken og:image links from old shared og-image URLs