Skip to content

Comments

fix: canonical links#214

Merged
sriramveeraghanta merged 2 commits intomasterfrom
fix-canonical-links
Feb 23, 2026
Merged

fix: canonical links#214
sriramveeraghanta merged 2 commits intomasterfrom
fix-canonical-links

Conversation

@sriramveeraghanta
Copy link
Member

@sriramveeraghanta sriramveeraghanta commented Feb 23, 2026

Summary by CodeRabbit

  • Chores
    • Enhanced SEO configuration in documentation to dynamically generate search engine metadata. The change ensures proper URL handling for all documentation pages, replacing manual configuration with automatic optimization based on page structure.

@vercel
Copy link

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
developer-docs Ready Ready Preview, Comment Feb 23, 2026 0:43am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

Warning

Rate limit exceeded

@sriramveeraghanta has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d8a8468 and 6abf57e.

📒 Files selected for processing (1)
  • docs/.vitepress/config.mts
📝 Walkthrough

Walkthrough

The canonical URL generation in VitePress configuration is refactored from a static head configuration to a dynamic transformPageData hook that computes URLs from page relative paths, automatically stripping index.md and .md extensions.

Changes

Cohort / File(s) Summary
VitePress Configuration
docs/.vitepress/config.mts
Replaced static canonical link with a transformPageData hook that dynamically generates canonical URLs from pageData.relativePath, removing index.md and .md file extensions, and appends the result to page frontmatter head metadata.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A canonical URL danced alone,
Static and still as a stone,
But now it springs free and alive,
From dynamic hooks where paths thrive,
Each page finds its home—hooray!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: canonical links' directly addresses the main change—converting static canonical link injection to dynamic generation via a transformPageData hook.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-canonical-links

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/.vitepress/config.mts (1)

127-127: Consider extracting the hardcoded base URL to a shared constant

https://developers.plane.so appears three times: Line 77 (sitemap.hostname), Line 117 (og:url), and here. A single constant avoids drift if the domain changes.

♻️ Proposed refactor
+const BASE_URL = 'https://developers.plane.so'
+
 export default withMermaid(defineConfig({
   ...
   sitemap: {
-    hostname: 'https://developers.plane.so'
+    hostname: BASE_URL
   },
   ...
   head: [
     ...
-    ['meta', { property: 'og:url', content: 'https://developers.plane.so' }],
+    ['meta', { property: 'og:url', content: BASE_URL }],
   ],
   ...
   transformPageData(pageData) {
-    const canonicalUrl = `https://developers.plane.so/${pageData.relativePath}`
+    const canonicalUrl = `${BASE_URL}/${pageData.relativePath}`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/.vitepress/config.mts` at line 127, Extract the hardcoded base URL into
a single shared constant and use it everywhere instead of repeating the literal;
for example, add a BASE_DOCS_URL constant (e.g., const BASE_DOCS_URL =
"https://developers.plane.so") and update the canonicalUrl construction (const
canonicalUrl = `${BASE_DOCS_URL}/${pageData.relativePath}`) and the other
occurrences that set sitemap.hostname and the og:url to reference BASE_DOCS_URL
so the domain is maintained in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/.vitepress/config.mts`:
- Around line 126-136: transformPageData currently unconditionally pushes a
canonical link into pageData.frontmatter.head which can create duplicates;
update transformPageData to first ensure pageData.frontmatter.head is an array
and then check for an existing head entry where the tag is 'link' and attrs.rel
=== 'canonical' (or attrs.href === canonicalUrl) before pushing; if a canonical
exists, either skip pushing or update its href to canonicalUrl to deduplicate;
reference pageData.frontmatter.head, canonicalUrl and the transformPageData
function when making the change.

---

Nitpick comments:
In `@docs/.vitepress/config.mts`:
- Line 127: Extract the hardcoded base URL into a single shared constant and use
it everywhere instead of repeating the literal; for example, add a BASE_DOCS_URL
constant (e.g., const BASE_DOCS_URL = "https://developers.plane.so") and update
the canonicalUrl construction (const canonicalUrl =
`${BASE_DOCS_URL}/${pageData.relativePath}`) and the other occurrences that set
sitemap.hostname and the og:url to reference BASE_DOCS_URL so the domain is
maintained in one place.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 419827f and d8a8468.

📒 Files selected for processing (1)
  • docs/.vitepress/config.mts

@sriramveeraghanta sriramveeraghanta merged commit 76e05c2 into master Feb 23, 2026
4 of 5 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-canonical-links branch February 23, 2026 12:44
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.

2 participants