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

DOP-5078: Fix duplicate "docs" prefix in BreadcrumbList #1285

Merged
merged 10 commits into from
Oct 21, 2024

Conversation

rayangler
Copy link
Collaborator

@rayangler rayangler commented Oct 17, 2024

Stories/Links:

DOP-5078

Current Behavior:

Staging Links:

Notes:

  • Previously used baseUrl() included /docs/ after the site URL. This meant that when withPrefix was applied while constructing breadcrumbs, there'd be duplicate prefixes in the final full URL.
  • To test, please go to the staging link and ensure that:
    • Breadcrumb links go to correct pages.
    • BreadcrumbList structured data shows the site URL, followed by the build/staging prefix, followed by the actual page path.

Bonus

README updates

    • This PR introduces changes that should be reflected in the README, and I have made those updates.
    • This PR does not introduce changes that should be reflected in the README

Copy link

netlify bot commented Oct 17, 2024

Deploy Preview for mongodb-snooty ready!

Name Link
🔨 Latest commit 3414e58
🔍 Latest deploy log https://app.netlify.com/sites/mongodb-snooty/deploys/6716c657e040b30008d222c3
😎 Deploy Preview https://deploy-preview-1285--mongodb-snooty.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@rayangler rayangler marked this pull request as ready for review October 17, 2024 20:48
Copy link
Collaborator

@seungpark seungpark left a comment

Choose a reason for hiding this comment

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

nice catch! mostly LGTM. just two non blocking comments

src/utils/get-complete-breadcrumb-data.js Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we also add a test with breadcrumbs representative of the db. these contain paths that are relative ie.

{
  "baseUrl": "https://mongodb.com/docs/",
  "slug": "atlas/cli/stable/",
  "title": "Atlas CLI",
  "projectName": "atlas-cli",
  "showInProductsList": true,
  "breadcrumbs": [
    {
      "title": "MongoDB Atlas",
      "path": "/atlas"
    }
  ]
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's an existing test that includes intermediate breadcrumbs with full URLs as well as breadcrumbs with relative paths. Is that what you're looking for?

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah i think this was not tested as this is used in DocumentBody and not caught in a snapshot (as far as Structured Data)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahhh, I can add a separate test for the structured data as part of this PR on Monday

@@ -12,6 +12,7 @@ export const useSiteMetadata = () => {
parserUser
patchId
pathPrefix
project
Copy link
Collaborator

Choose a reason for hiding this comment

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

Trying to figure out why this was added in this PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When checking for usage of siteUrl, I noticed that the build metadata object we use for this hook had project, but the hook was not returning project. I added it here for completeness so it can be used properly.

It's completely out of scope for this PR, but added it as a bonus since it was a small change. Happy to create a separate PR for it if you'd prefer!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Keep it in! Thank you for the explanation!

Copy link
Collaborator

@seungpark seungpark left a comment

Choose a reason for hiding this comment

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

changes LGTM. can follow up to include a test of breadcrumb structured data

@@ -22,10 +22,6 @@ const FootnoteReference = ({ nodeData: { id, refname } }) => {
const { footnotes } = useContext(FootnoteContext);
const { darkMode } = useDarkMode();

// the nodeData originates from docutils, and may be incorrect for
Copy link
Collaborator

Choose a reason for hiding this comment

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

guessing this change is not from this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's one of the bonus changes mentioned above. Figured I'd just lump it in this PR since it's small and I was planning on making a commit for it anyways, but happy to make it separate if needed!

@mmeigs mmeigs self-requested a review October 21, 2024 13:39
@rayangler
Copy link
Collaborator Author

include a test of breadcrumb structured data

@seungpark I added tests in the latest commits. Please feel free to take a look

@rayangler rayangler merged commit 09442dc into main Oct 21, 2024
6 checks passed
@rayangler rayangler deleted the DOP-5078-repeated-docs-breadcrumbs branch October 21, 2024 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants