Skip to content

[docs] Fix broken social preview image on shared docs links#23055

Merged
sai6855 merged 1 commit into
mui:masterfrom
sai6855:charts-og
Jul 6, 2026
Merged

[docs] Fix broken social preview image on shared docs links#23055
sai6855 merged 1 commit into
mui:masterfrom
sai6855:charts-og

Conversation

@sai6855

@sai6855 sai6855 commented Jul 3, 2026

Copy link
Copy Markdown
Member

Added hostUrl: 'https://mui.com' to DOCS_CONFIG in docs/pages/_app.tsx to specify the absolute origin for canonical and social-preview URLs (og:url, og:image).

Before and after

Screenshot_20260704_002419_WhatsApp

@code-infra-dashboard

code-infra-dashboard Bot commented Jul 3, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-23055--material-ui-x.netlify.app/
QR code for https://deploy-preview-23055--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-scheduler 0B(0.00%) 0B(0.00%)
@mui/x-scheduler-premium 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

The docs `AppLayoutHead` builds `og:url`, `og:image`, and `twitter:image`
by interpolating `hostUrl` from the docs config. `DOCS_CONFIG` spread
`DEFAULT_DOCS_CONFIG` without setting `hostUrl`, so the value was
`undefined` and every social meta tag resolved to
`undefined/edge-functions/og-image?...`, which social platforms could
not load. Set `hostUrl` to `https://mui.com`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_012auoswyk6M4Ji3R5y4U8U3
@sai6855 sai6855 added type: bug It doesn't behave as expected. docs Improvements or additions to the documentation. labels Jul 3, 2026
@sai6855
sai6855 requested a review from Copilot July 3, 2026 18:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the MUI X documentation app configuration to ensure canonical and social preview meta URLs (notably og:url and og:image) are generated with an absolute origin, preventing broken previews when docs links are shared.

Changes:

  • Add hostUrl: 'https://mui.com' to DOCS_CONFIG in the docs custom app to set an explicit absolute origin for URL generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sai6855
sai6855 marked this pull request as ready for review July 4, 2026 03:20
@sai6855
sai6855 requested a review from brijeshb42 July 6, 2026 06:31

@brijeshb42 brijeshb42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Does this need fixing in core repo as well ?

@sai6855

sai6855 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

Nice catch. Does this need fixing in core repo as well ?

Don't think so, I can see social preview for material-ui.

image

@sai6855
sai6855 merged commit 9a1d486 into mui:master Jul 6, 2026
23 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants