Add sitemap.xml and robots.txt with canonical URLs#36
Draft
Conversation
- Add Next.js metadata routes (force-static for static export) - Resolve site origin via NEXT_PUBLIC_SITE_URL, SITE_URL, or VERCEL_URL - Include base path in loc URLs when NEXT_PUBLIC_BASE_PATH is set - Set layout metadataBase for consistent canonical metadata - Document SITE_URL in README, architecture, and deployment docs Co-authored-by: Aanish Bhirud <baanish@users.noreply.github.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Deploying agent-render with
|
| Latest commit: |
eaa780b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ace11649.agent-render.pages.dev |
| Branch Preview URL: | https://cursor-sitemap-robots-canoni.agent-render.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Next.js App Router metadata routes so the static export publishes
/sitemap.xml(valid Sitemaps 0.9 XML) and/robots.txtwith aSitemap:line pointing at the absolute sitemap URL.Details
src/lib/site/canonical-base.ts: resolves the public origin fromNEXT_PUBLIC_SITE_URL,SITE_URL, thenVERCEL_URL, elsehttp://localhost:3000for local builds; appliesNEXT_PUBLIC_BASE_PATHso subpath deploys get URLs likehttps://host/base/andhttps://host/base/sitemap.xml.src/app/sitemap.ts/src/app/robots.ts:export const dynamic = "force-static"required foroutput: "export".src/app/layout.tsx: setsmetadataBasefrom the same helper so relative metadata URLs resolve consistently.docs/deployment.md, anddocs/architecture.mdmentionNEXT_PUBLIC_SITE_URLfor production canonical URLs.Verification
npm run checkpassed locally.Notes for deployers
Set
NEXT_PUBLIC_SITE_URL(e.g.https://agent-render.com) in the static host build environment so sitemap/robots use the live domain instead of localhost / preview host.