Skip to content

fix(seo): use canonical SITE_URL for robots and sitemap#4598

Merged
waleedlatif1 merged 2 commits into
stagingfrom
waleedlatif1/fix-sitemap-urls
May 14, 2026
Merged

fix(seo): use canonical SITE_URL for robots and sitemap#4598
waleedlatif1 merged 2 commits into
stagingfrom
waleedlatif1/fix-sitemap-urls

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • robots.txt and sitemap.xml were emitting http://localhost:3000 URLs in production (NEXT_PUBLIC_APP_URL got baked at build time with the wrong value)
  • switch both to canonical SITE_URL (https://www.sim.ai) — matches existing seo.test.ts convention used by other SEO surfaces (rss.xml, sitemap-images.xml, changelog.xml)
  • add missing /contact and /templates pages to the sitemap

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 14, 2026 5:15pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 14, 2026

PR Summary

Low Risk
Low risk: changes are limited to SEO route outputs (robots.ts, sitemap.ts) and adds a test guard against regressions; no auth or data-handling logic is affected.

Overview
Ensures robots.ts and sitemap.ts emit canonical SEO URLs by replacing getBaseUrl() usage with SITE_URL, preventing build-time NEXT_PUBLIC_APP_URL misconfiguration from leaking localhost into robots.txt/sitemap.xml.

Updates the sitemap to include /contact, and extends seo.test.ts with a targeted check that robots.ts/sitemap.ts do not reference getBaseUrl (in addition to scanning these files for other SEO URL issues).

Reviewed by Cursor Bugbot for commit b28df2e. Configure here.

Comment thread apps/sim/app/sitemap.ts Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 14, 2026

Greptile Summary

This PR fixes a production SEO regression where robots.txt and sitemap.xml were emitting http://localhost:3000 URLs because getBaseUrl() resolves dynamically at runtime from NEXT_PUBLIC_APP_URL, which was baked in at build time with the wrong value. Both files are switched to the hard-coded SITE_URL constant (https://www.sim.ai), consistent with how other SEO surfaces (rss.xml, sitemap-images.xml, changelog.xml) already work.

  • robots.ts and sitemap.ts: getBaseUrl() import replaced with SITE_URL; /contact added to the sitemap's static pages list.
  • seo.test.ts: Both files added to SEO_SCAN_INDIVIDUAL_FILES; a new dedicated test (SEO_DEFAULT_EXPORT_FILES) asserts neither file ever imports getBaseUrl, preventing a future regression that the existing metadata-export check would have silently missed.

Confidence Score: 5/5

Safe to merge — targeted swap of a dynamic URL resolver for a compile-time constant in two small, well-understood SEO route handlers, with a new regression test that locks the fix in place.

Both changed route handlers are straightforward; the fix is a one-line import swap with no side effects on application logic. The new test in seo.test.ts correctly guards against reintroducing getBaseUrl in these files, and all three existing SEO assertions continue to cover them.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/robots.ts Replaces getBaseUrl() with SITE_URL constant; removes the dynamic baseUrl variable entirely — clean and correct.
apps/sim/app/sitemap.ts Replaces getBaseUrl() with SITE_URL and adds /contact to static pages; /templates mentioned in PR description is absent but no evidence the route exists.
apps/sim/app/(landing)/seo.test.ts Adds robots.ts/sitemap.ts to SEO_SCAN_INDIVIDUAL_FILES and a dedicated getBaseUrl-import check via SEO_DEFAULT_EXPORT_FILES; regression coverage is solid.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Next.js Build] -->|Before fix| B["getBaseUrl()\nreads NEXT_PUBLIC_APP_URL\nbaked at build time"]
    B --> C["robots.txt / sitemap.xml\nemit http://localhost:3000"]

    A -->|After fix| D["SITE_URL constant\n'https://www.sim.ai'"]
    D --> E["robots.txt / sitemap.xml\nemit https://www.sim.ai"]

    F["seo.test.ts"] -->|SEO_DEFAULT_EXPORT_FILES| G["assert: robots.ts &\nsitemap.ts do NOT\nimport getBaseUrl"]
    F -->|SEO_SCAN_INDIVIDUAL_FILES| H["assert: no hardcoded\nhttps://sim.ai without www"]
Loading

Reviews (2): Last reviewed commit: "fix(seo): drop /templates from sitemap a..." | Re-trigger Greptile

Comment thread apps/sim/app/sitemap.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b28df2e. Configure here.

@waleedlatif1 waleedlatif1 merged commit 8831def into staging May 14, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/fix-sitemap-urls branch May 14, 2026 17:25
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.

1 participant