Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Redirect old urls to /material/* when search #30286

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Dec 20, 2021

This PR cover all scenarios when searching with cmd+K (algolia search):

Before migration
The feature toggle is not turned on, so the behavior is still the same.

Migration phase
When the contents are duplicated to docs/pages/material/* and the feature toggle is turned on, all the search results (related to components, API, etc.) are replaced to point to /material/* URL.

Post migration
The search config on the doc search is updated and the new /material/* have been indexed, the URL will not be replaced because of the regex in the code.

✅ E2E website added.


@siriwatknp siriwatknp mentioned this pull request Dec 20, 2021
32 tasks
@mui-pr-bot
Copy link

mui-pr-bot commented Dec 20, 2021

No bundle size changes

Generated by 🚫 dangerJS against aa23f5c

@danilo-leal danilo-leal added the docs Improvements or additions to the documentation label Dec 20, 2021
@siriwatknp siriwatknp merged commit fc8a9d3 into mui:master Dec 21, 2021
@@ -298,7 +299,7 @@ export default function AppSearch() {
}

// TODO: remove this logic once the migration to new structure is done.
if (router.asPath.startsWith('/material')) {
if (FEATURE_TOGGLE.enable_product_scope) {
parseUrl.href = parseUrl.href.replace(
/(?<!material\/)(getting-started|components|api|customization|guides|discover-more)(\/[^/]+\/)/,
`material/$1$2`,
Copy link
Member

Choose a reason for hiding this comment

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

Is this enough? When I run

'https://mui.com/components/alert/'.replace(
                    /(?<!material\/)(getting-started|components|api|customization|guides|discover-more)(\/[^/]+\/)/,
                    `material/$1$2`,
                  )

I get https://mui.com/material/components/alert/ as an output. Based on https://www.notion.so/mui-org/Documentation-per-product-decision-time-d9347d7d37b641129d2fea12d68555d2. Should we get https://mui.com/material/react-alert/?

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea is to keep url the same to not have many broken things but the correct URL will be handled before the migration time.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants