-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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-infra][toolpad] Fix Page title and SERP title mismatch #41919
Conversation
Netlify deploy previewhttps://deploy-preview-41919--material-ui.netlify.app/ Bundle size report |
import { | ||
AD_MARGIN_TOP, | ||
AD_HEIGHT, | ||
AD_HEIGHT_MOBILE, | ||
AD_MARGIN_BOTTOM, | ||
} from 'docs/src/modules/components/Ad'; | ||
import { convertProductIdToName } from './AppSearch'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid the relative imports. It's creating issues with other repository reusing the code
let productName = 'MUI'; | ||
if (canonicalAs.startsWith('/material-ui/')) { | ||
productName = 'Material UI'; | ||
} else if (canonicalAs.startsWith('/base-ui/')) { | ||
productName = 'Base UI'; | ||
} else if (canonicalAs.startsWith('/x/')) { | ||
productName = 'MUI X'; | ||
} else if (canonicalAs.startsWith('/system/')) { | ||
productName = 'MUI System'; | ||
} else if (canonicalAs.startsWith('/toolpad/')) { | ||
productName = 'MUI Toolpad'; | ||
} else if (canonicalAs.startsWith('/joy-ui/')) { | ||
productName = 'Joy UI'; | ||
} | ||
productName = convertProductIdToName(getProductInfoFromUrl(router.asPath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner, but this does not support fall back to MUI. The convertProductIdToName
will return undefined
for unknown id.
const productNameProductId = {
'material-ui': 'Material UI',
'joy-ui': 'Joy UI',
'base-ui': 'Base UI',
x: 'MUI X',
system: 'MUI System',
toolpad: 'Toolpad',
'toolpad-studio': 'Toolpad Studio',
'toolpad-core': 'Toolpad Core',
};
export function convertProductIdToName(productInfo) {
return (
productNameProductId[productInfo.productId] ||
productNameProductId[productInfo.productCategoryId]
);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but this does not support fall back to MUI.
Should it throw instead? Helping catch bugs sooner, I imagine we will never use "MUI" for a docs page. For https://next--material-ui.netlify.app/experiments/docs/headers/, we might need to have "Docs infra" productId to name conversion.
A step toward finishing the renaming of "MUI Toolpad" to "Toolpad".
The issue is visible from the 12 April Ahrefs audit: