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: Custom canonical tags #11658

Merged
merged 3 commits into from
Oct 28, 2024
Merged

feat: Custom canonical tags #11658

merged 3 commits into from
Oct 28, 2024

Conversation

coolguyzone
Copy link
Collaborator

@coolguyzone coolguyzone commented Oct 24, 2024

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.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

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

Copy link

vercel bot commented Oct 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
changelog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 28, 2024 6:19pm
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 28, 2024 6:19pm
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 28, 2024 6:19pm

Copy link

codecov bot commented Oct 24, 2024

Bundle Report

Changes will increase total bundle size by 539 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 7.38MB 548 bytes (0.01%) ⬆️
sentry-docs-edge-server-array-push 333.11kB 3 bytes (-0.0%) ⬇️
sentry-docs-client-array-push 6.44MB 6 bytes (-0.0%) ⬇️

Copy link
Member

@mjq mjq left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -132,6 +132,17 @@ type MetadataProps = {
};
};

// Helper function to clean up canonical tags missing leading or trailing slash
function checkCanonicalTagFormat(tag: string) {
Copy link
Member

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

Copy link
Collaborator Author

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/"
Copy link
Member

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

Copy link
Member

@chargome chargome left a 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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants