-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: Custom canonical tags #11658
feat: Custom canonical tags #11658
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Bundle ReportChanges will increase total bundle size by 539 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
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.
LGTM!
app/[[...path]]/page.tsx
Outdated
@@ -132,6 +132,17 @@ type MetadataProps = { | |||
}; | |||
}; | |||
|
|||
// Helper function to clean up canonical tags missing leading or trailing slash | |||
function checkCanonicalTagFormat(tag: string) { |
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.
super nitpicky: check...
makes me think this is going to return a boolean rather than a transformed value. Maybe formatCanonicalTag()
? 100% a judgement call and not blocking this PR whatsoever
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.
Thanks @mjq! I went ahead and took your suggestion as well as moving the formatting function call to make things a little more readable.
@@ -18,6 +18,7 @@ notSupported: | |||
- javascript.nestjs | |||
- javascript.cloudflare | |||
description: "Configuring Session Replay to maintain user and data privacy." | |||
customCanonicalTag: "/platforms/javascript/session-replay/privacy/" |
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.
Looks like we're inconsistent between camelCase and snake_case naming for our frontmatter properties, alas. Maybe a cleanup task someday
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.
LGTM
Regarding tests – the unit tests currently just live next to the source file in a .spec file – and we're using vitest, so we can get actually get rid of the jest dependency
DESCRIBE YOUR PR
We've been asked to update some canonical tags, the request is documented here:
https://docs.google.com/spreadsheets/d/1jaP6A53p09vxoCLMhaX2RcynERN3PE0AsIAOJYNwq44/edit?usp=sharing
The codebase didn't have the capability to add custom canonical tags, so I added it through Frontmatter data, and updated the canonicals of the urls in the document above.
To verify:
Go to https://sentry-docs-git-custom-canonical-tags.sentry.dev/platforms/javascript/guides/react/configuration/options/
and inspect, you'll see a canonical tag as follows:
<link rel="canonical" href="https://docs.sentry.io/platforms/javascript/configuration/options/">
Go to https://sentry-docs-git-custom-canonical-tags.sentry.dev/platforms/javascript/guides/react/session-replay/privacy/ and inspect and you'll see a canonical tag as follows:
<link rel="canonical" href="https://docs.sentry.io/platforms/javascript/session-replay/privacy/">
Notice the canonical urls are different from the page urls. This works for all the urls requested in the user doc.
Go to any other docs page on my preview branch, and you'll see the canonical tag is the same as the page url, which is expected behavior.
I saw Jest is in the codebase but didn't see any place where unit tests live, if I missed them let me know.
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
LEGAL BOILERPLATE
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
EXTRA RESOURCES