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

feat: add SEO microdata for doc breadcrumbs #6697

Merged
merged 4 commits into from
Mar 14, 2022
Merged

Conversation

Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena commented Feb 17, 2022

Motivation

Continuation of #6517

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Test on this page: https://search.google.com/test/rich-results

With the following URLs:

@Josh-Cena Josh-Cena added the pr: new feature This PR adds a new API or behavior. label Feb 17, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 17, 2022
<span className={className}>{children}</span>
<span className={className} itemProp="item name">
{children}
</span>
);
}

// TODO move to design system folder
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not even sure what "design system folder" is, and my intuition tells me I don't like this direction😅 Is that like theme-common?

Copy link
Collaborator

@slorber slorber Feb 17, 2022

Choose a reason for hiding this comment

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

@Josh-Cena it's a good practice to have a design system for the consistency of any React app

We already have one design system anyway: Infima, but it's a CSS one

As we are in React land, we should create a well-encapsulated abstraction on top (think "infima-react") instead of using infima class names and low-level dom elements everywhere in our theme.

This is related to the theme vision in #6649 (comment)

This is not the same as theme-common, because it's not shared

In general, we should have a good separation of micro layouts (https://web.dev/learn/design/micro-layouts/) vs macro layouts (https://web.dev/learn/design/macro-layouts/) and try to keep technical code out of these

Design system components are particularly suited to be swizzled (eject + copy)

Component users should not have to think about classes, but only props

The design system should be well-encapsulated and prevent impossible/arbitrary UI states

You might also like:
https://www.codercto.com/a/106766.html
https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/buildingfasterwithcomponents

@netlify
Copy link

netlify bot commented Feb 17, 2022

✔️ [V2]

🔨 Explore the source changes: 3ec32b4

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/6225c78fd02cc200077c1a11

😎 Browse the preview: https://deploy-preview-6697--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Feb 17, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 57
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-6697--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Feb 17, 2022

Size Change: 0 B

Total Size: 791 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 49.9 kB
website/build/assets/css/styles.********.css 105 kB
website/build/assets/js/main.********.js 597 kB
website/build/index.html 38.4 kB

compressed-size-action

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

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

Thanks 👍

I'll approve because it's an improvement and seems to work

But not 100% satisfied with the way it's implemented.

Not a big deal though, we can refactor this later anyway

<Link className={className} href={href}>
{children}
<Link className={className} href={href} itemProp="item">
<span itemProp="name">{children}</span>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need the extra span here and why?

Can't we apply "name" to the link directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I've experimented. Without the span, the name is not correctly recognized.

@@ -71,13 +79,17 @@ export default function DocBreadcrumbs(): JSX.Element | null {
styles.breadcrumbsContainer,
)}
aria-label="breadcrumbs">
<ul className="breadcrumbs">
<ul
Copy link
Collaborator

Choose a reason for hiding this comment

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

similarly, I didn't do it yet but this must be encapsulated under a <Breadcrumbs> component

@Josh-Cena
Copy link
Collaborator Author

Will refactor it later, absolutely, I just pushed an initial version that seemed to work after countless trials😅 I will still experiment if we can get the "invalid ID" warning fixed in this PR, so we don't ship any bad practices.

@Josh-Cena
Copy link
Collaborator Author

Going to merge and see if anyone complains...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants