Skip to content

robots.txt and sitemap.xml missing – T#444

Open
Gadflyxx wants to merge 2 commits into
Pi-Defi-world:devfrom
Gadflyxx:dev
Open

robots.txt and sitemap.xml missing – T#444
Gadflyxx wants to merge 2 commits into
Pi-Defi-world:devfrom
Gadflyxx:dev

Conversation

@Gadflyxx

@Gadflyxx Gadflyxx commented Jun 1, 2026

Copy link
Copy Markdown

Summary

Fixes two issues: #323 and #359.


#323 — Form reset on tab switch in /currency

Root cause: step was a single shared state across all three tabs. Switching tabs carried the step into the new tab, and <Tabs> used defaultValue (uncontrolled) so activeTab state could drift from the rendered tab.

Fix:

  • Replaced const [step, setStep] with const [tabSteps, setTabSteps] — a Record<tab, TabStep> giving each tab its own independent step
  • Derived step/setStep from tabSteps[activeTab] — all existing call sites unchanged
  • Switched <Tabs defaultValue="mint"><Tabs value={activeTab}> (controlled)
  • resetForm now only clears the active tab's fields, not all three

Also fixed pre-existing bugs in the same file:

  • Duplicate useBalance() call (would throw a React hook error)
  • setSubmitError called but never defined → setApiError
  • QuoteResponse used in state but not imported
  • export const metadata in a "use client" file (silently ignored by Next.js — removed)
    closes Form reset on tab switch in /currency – M #323

#359 — robots.txt and sitemap.xml missing

Added app/robots.ts and app/sitemap.ts using Next.js's built-in Metadata Route API (generates /robots.txt and /sitemap.xml at build time — no static files needed).

  • robots.ts: blocks all crawlers from every authenticated route (/me/, /wallet/, /currency/, /transactions/, etc.), allows only public pages
  • sitemap.ts: lists only the 4 genuinely public URLs — /, /auth/signin, /auth/signup, /recovery
  • Both respect NEXT_PUBLIC_SITE_URL env var with fallback to https://app.acbu.io

Files changed

Summary by CodeRabbit

  • New Features

    • Added search engine crawler configuration to control site discoverability and access policies.
    • Added sitemap to improve search engine indexing of key application pages.
  • Refactor

    • Improved currency page tab-based form state management with enhanced confirmation step handling.
    • Refined form reset logic to independently manage input fields for each active tab.

Gadflyxx added 2 commits June 1, 2026 13:19
…dd robots.txt & sitemap

Pi-Defi-world#323: Replace shared step state with per-tab tabSteps record so
switching tabs no longer resets other tabs' form input. Switch Tabs
from uncontrolled (defaultValue) to controlled (value). resetForm
now only clears the active tab's fields.

Also fixed pre-existing bugs in the same file:
- Duplicate useBalance() call
- setSubmitError -> setApiError
- Missing QuoteResponse import
- metadata export in a use client file

Pi-Defi-world#359: Add app/robots.ts and app/sitemap.ts via Next.js Metadata
Route API. robots.ts disallows all authenticated routes; sitemap.ts
lists only the 4 public pages (/, /auth/signin, /auth/signup,
/recovery). Both respect NEXT_PUBLIC_SITE_URL env var.
…bots-sitemap

fix(Pi-Defi-world#323,Pi-Defi-world#359): preserve currency tab form state + add robots.txt & sitemap
@drips-wave

drips-wave Bot commented Jun 1, 2026

Copy link
Copy Markdown

@Gadflyxx Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds Next.js SEO metadata routes (robots.ts and sitemap.ts) and refactors form state management in the currency page to preserve per-tab input. The confirmation step is moved from a global state into a per-tab map keyed by activeTab, and form reset now clears only the current tab's fields.

Changes

SEO Metadata Routes

Layer / File(s) Summary
Robots and sitemap metadata
app/robots.ts, app/sitemap.ts
New metadata routes define crawl rules and site structure. Both compute base URL from NEXT_PUBLIC_SITE_URL (fallback: https://app.acbu.io), with robots configuring user-agent allow/disallow rules and sitemap listing home, auth, and recovery routes with priority and change frequency.

Currency Page Tab-Specific Form State

Layer / File(s) Summary
Per-tab step state and helpers
app/currency/page.tsx
API type imports now include QuoteResponse. Confirmation step state is refactored from a single step variable into a per-tab tabSteps map keyed by activeTab, with a TabStep union type and setStep helper that updates only the current tab's step.
Form reset and controlled tabs
app/currency/page.tsx
resetForm resets only the current tab's step and clears input fields for that tab (mint/burn/international). Tabs component switches from uncontrolled defaultValue to controlled value prop. Exported metadata constant is removed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Form state takes a hop, per-tab it lands,
No more lost data when switching through strands,
Robots and sitemaps crawl the new way,
SEO's delight on this code-fixing day! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and incomplete. It mentions 'robots.txt and sitemap.xml missing' but cuts off at '– T', lacking clarity about the full scope of changes including the currency page refactoring. Complete the title to clearly describe all main changes, such as 'Add robots.ts and sitemap.ts, fix currency page tab state persistence' for better clarity.
Out of Scope Changes check ❓ Inconclusive Changes are mostly in scope, but removing the metadata export and fixing duplicate useBalance calls in currency/page.tsx appear tangential to the core tab state persistence issue. Clarify whether metadata and useBalance fixes are necessary for #323, or separate them into a distinct PR for better change isolation.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR successfully addresses issue #323 by implementing per-tab step management and controlled Tabs component, preserving form state across tab switches, and makes the add robots/sitemap changes (#359) mentioned in objectives.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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)
app/sitemap.ts (1)

4-10: ⚡ Quick win

Extract shared site-origin helper to avoid drift between sitemap and robots.

app/sitemap.ts and app/robots.ts duplicate base URL derivation. Centralizing this keeps both routes consistent and avoids future SEO mismatches.

Suggested refactor
+// lib/site-origin.ts
+export function getSiteOrigin(): string {
+  const raw = process.env.NEXT_PUBLIC_SITE_URL ?? "https://app.acbu.io";
+  return new URL(raw).origin;
+}
 // app/sitemap.ts
 import type { MetadataRoute } from "next";
+import { getSiteOrigin } from "`@/lib/site-origin`";
 
 export default function sitemap(): MetadataRoute.Sitemap {
-  const base = process.env.NEXT_PUBLIC_SITE_URL ?? "https://app.acbu.io";
+  const base = getSiteOrigin();
   return [
 // app/robots.ts
 import type { MetadataRoute } from "next";
+import { getSiteOrigin } from "`@/lib/site-origin`";
 
 export default function robots(): MetadataRoute.Robots {
-  const rawBase = process.env.NEXT_PUBLIC_SITE_URL ?? "https://app.acbu.io";
-  const base = new URL(rawBase).origin;
+  const base = getSiteOrigin();
   return {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/sitemap.ts` around lines 4 - 10, Extract the base URL derivation into a
shared helper (e.g., getSiteOrigin) so both sitemap.ts and robots.ts import the
same logic; move the code that computes const base =
process.env.NEXT_PUBLIC_SITE_URL ?? "https://app.acbu.io" into that helper,
export the function, and replace the inline base usages in sitemap.ts (the array
entries using `${base}`) and robots.ts to call getSiteOrigin() instead,
preserving the same env var name and fallback value to avoid any URL drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/robots.ts`:
- Around line 4-33: Normalize the NEXT_PUBLIC_SITE_URL before composing
metadata: compute a normalizedBase from process.env.NEXT_PUBLIC_SITE_URL
(fallback "https://app.acbu.io") by ensuring it includes a scheme (prepend
"https://" if missing) and stripping any trailing slashes (e.g., replace /\/+$/
with empty string), then use that normalizedBase instead of base when setting
sitemap (`sitemap: `${normalizedBase}/sitemap.xml``) and anywhere else `base` is
used so you never produce double slashes or malformed URLs.

---

Nitpick comments:
In `@app/sitemap.ts`:
- Around line 4-10: Extract the base URL derivation into a shared helper (e.g.,
getSiteOrigin) so both sitemap.ts and robots.ts import the same logic; move the
code that computes const base = process.env.NEXT_PUBLIC_SITE_URL ??
"https://app.acbu.io" into that helper, export the function, and replace the
inline base usages in sitemap.ts (the array entries using `${base}`) and
robots.ts to call getSiteOrigin() instead, preserving the same env var name and
fallback value to avoid any URL drift.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e871bf2e-b47a-42de-9922-bd437d977325

📥 Commits

Reviewing files that changed from the base of the PR and between 777a67b and ff05ab8.

📒 Files selected for processing (3)
  • app/currency/page.tsx
  • app/robots.ts
  • app/sitemap.ts

Comment thread app/robots.ts
Comment on lines +4 to +33
const base = process.env.NEXT_PUBLIC_SITE_URL ?? "https://app.acbu.io";
return {
rules: [
{
userAgent: "*",
allow: ["/", "/auth/signin", "/auth/signup", "/recovery"],
disallow: [
"/auth/2fa",
"/auth/wallet-setup",
"/me/",
"/wallet/",
"/send/",
"/currency/",
"/mint/",
"/burn/",
"/savings/",
"/lending/",
"/transactions/",
"/activity/",
"/bills/",
"/fiat/",
"/rates/",
"/reserves/",
"/business/",
"/api/",
],
},
],
sitemap: `${base}/sitemap.xml`,
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize NEXT_PUBLIC_SITE_URL before composing metadata URLs.

On Line 4 and Line 32, raw env concatenation can produce invalid URLs (e.g., double slashes or unexpected path prefixes), which can degrade crawler behavior.

Suggested fix
 import type { MetadataRoute } from "next";
 
 export default function robots(): MetadataRoute.Robots {
-  const base = process.env.NEXT_PUBLIC_SITE_URL ?? "https://app.acbu.io";
+  const rawBase = process.env.NEXT_PUBLIC_SITE_URL ?? "https://app.acbu.io";
+  const base = new URL(rawBase).origin;
   return {
     rules: [
       {
         userAgent: "*",
         allow: ["/", "/auth/signin", "/auth/signup", "/recovery"],
@@
     ],
     sitemap: `${base}/sitemap.xml`,
   };
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const base = process.env.NEXT_PUBLIC_SITE_URL ?? "https://app.acbu.io";
return {
rules: [
{
userAgent: "*",
allow: ["/", "/auth/signin", "/auth/signup", "/recovery"],
disallow: [
"/auth/2fa",
"/auth/wallet-setup",
"/me/",
"/wallet/",
"/send/",
"/currency/",
"/mint/",
"/burn/",
"/savings/",
"/lending/",
"/transactions/",
"/activity/",
"/bills/",
"/fiat/",
"/rates/",
"/reserves/",
"/business/",
"/api/",
],
},
],
sitemap: `${base}/sitemap.xml`,
};
const rawBase = process.env.NEXT_PUBLIC_SITE_URL ?? "https://app.acbu.io";
const base = new URL(rawBase).origin;
return {
rules: [
{
userAgent: "*",
allow: ["/", "/auth/signin", "/auth/signup", "/recovery"],
disallow: [
"/auth/2fa",
"/auth/wallet-setup",
"/me/",
"/wallet/",
"/send/",
"/currency/",
"/mint/",
"/burn/",
"/savings/",
"/lending/",
"/transactions/",
"/activity/",
"/bills/",
"/fiat/",
"/rates/",
"/reserves/",
"/business/",
"/api/",
],
},
],
sitemap: `${base}/sitemap.xml`,
};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/robots.ts` around lines 4 - 33, Normalize the NEXT_PUBLIC_SITE_URL before
composing metadata: compute a normalizedBase from
process.env.NEXT_PUBLIC_SITE_URL (fallback "https://app.acbu.io") by ensuring it
includes a scheme (prepend "https://" if missing) and stripping any trailing
slashes (e.g., replace /\/+$/ with empty string), then use that normalizedBase
instead of base when setting sitemap (`sitemap:
`${normalizedBase}/sitemap.xml``) and anywhere else `base` is used so you never
produce double slashes or malformed URLs.

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.

robots.txt and sitemap.xml missing – T Form reset on tab switch in /currency – M

1 participant