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-infra][toolpad] Fix Page title and SERP title mismatch #41919

Merged
merged 5 commits into from
May 16, 2024

Conversation

bharatkashyap
Copy link
Member

@bharatkashyap bharatkashyap commented Apr 16, 2024

A step toward finishing the renaming of "MUI Toolpad" to "Toolpad".

The issue is visible from the 12 April Ahrefs audit:

Screenshot 2024-04-16 at 2 40 53 PM

@bharatkashyap bharatkashyap added the website Pages that are not documentation-related, marketing-focused. label Apr 16, 2024
@bharatkashyap bharatkashyap requested a review from a team April 16, 2024 09:12
@mui-bot
Copy link

mui-bot commented Apr 16, 2024

Netlify deploy preview

https://deploy-preview-41919--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 4cecbf5

import {
AD_MARGIN_TOP,
AD_HEIGHT,
AD_HEIGHT_MOBILE,
AD_MARGIN_BOTTOM,
} from 'docs/src/modules/components/Ad';
import { convertProductIdToName } from './AppSearch';
Copy link
Member

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

Comment on lines 123 to 124
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));
Copy link
Member

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]
  );
}

Copy link
Member

@oliviertassinari oliviertassinari Apr 17, 2024

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.

@oliviertassinari oliviertassinari changed the title [website] [toolpad] Fix Page title and SERP title mismatch [website][toolpad] Fix Page title and SERP title mismatch Apr 17, 2024
@oliviertassinari oliviertassinari changed the title [website][toolpad] Fix Page title and SERP title mismatch [docs-infra][toolpad] Fix Page title and SERP title mismatch Apr 17, 2024
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work scope: docs-infra Specific to the docs-infra product and removed website Pages that are not documentation-related, marketing-focused. labels Apr 17, 2024
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 19, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label May 8, 2024
@bharatkashyap bharatkashyap merged commit dc922ee into mui:next May 16, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants