Skip to content

fix: serve docs at root URL instead of /docs#6

Merged
Kamilbenkirane merged 1 commit intomainfrom
fix/root-url-structure
Nov 26, 2025
Merged

fix: serve docs at root URL instead of /docs#6
Kamilbenkirane merged 1 commit intomainfrom
fix/root-url-structure

Conversation

@Kamilbenkirane
Copy link
Member

Summary

  • Move [[...slug]] route from /docs/ to root level
  • Merge DocsLayout into root layout
  • Delete redirect page and unnecessary docs layout
  • Add favicon (icon.svg) for browser tab

Fixes

  1. URL is now / instead of /docs - docs.withceleste.ai/ works directly
  2. Navigation works - removed server-only redirect() that didn't work with static export
  3. Favicon shows in browser tab - added icon.svg

Test plan

  • Build succeeds
  • docs.withceleste.ai/ loads the docs root page
  • Navigation between pages works
  • Favicon appears in browser tab

- Move [[...slug]] route from /docs to root
- Merge DocsLayout into root layout
- Delete redirect page and docs layout
- Add favicon (icon.svg)
@Kamilbenkirane Kamilbenkirane merged commit e688085 into main Nov 26, 2025
1 check passed
@claude
Copy link

claude bot commented Nov 26, 2025

Code Review for PR #6

Summary

This PR refactors the routing structure to serve documentation at the root URL (/) instead of /docs. The changes include moving the catch-all route, merging layouts, and adding a favicon.


✅ Positive Aspects

  1. Clear architectural improvement - Consolidating layouts reduces complexity and improves maintainability
  2. Correct Next.js App Router patterns - Proper use of catch-all routes with [[...slug]] syntax
  3. Import organization - Consistent grouping of external imports before internal imports
  4. Static export compatibility - Correctly uses staticGET in search route and removes server-only redirect()
  5. Favicon addition - Good UX improvement with a properly formatted SVG icon

🔴 Critical Issues

1. Route Conflict - This will break! 🚨

Location: src/app/(home)/page.tsx:9 and src/app/[[...slug]]/page.tsx

The (home) route group contains a page at / that has a hardcoded link to /docs:

<Link href="/docs" className="font-medium underline">
  /docs
</Link>

Problem: With the catch-all route at [[...slug]], you now have:

  • src/app/(home)/page.tsx → renders at /
  • src/app/[[...slug]]/page.tsx → also renders at /

This creates a route conflict. Next.js may unpredictably choose which page to render at /.

Solutions:

  1. Delete src/app/(home)/page.tsx and src/app/(home)/layout.tsx if you want docs at root
  2. OR keep them and don't use the catch-all route for the root path
  3. Update the /docs link to / if keeping the home page

2. Incorrect baseUrl but URL generation might work ⚠️

Location: src/lib/source.ts:7

Changed from baseUrl: "/docs" to baseUrl: "/", which is correct for the new routing. However, the getPageImage function still generates OG image URLs with /og/docs/ prefix:

url: `/og/docs/${segments.join("/")}`,

This should likely be /og/${segments.join("/")} to match the new structure. However, verify if the OG route at src/app/og/docs/[...slug]/route.tsx is intentionally kept at /docs path.


⚠️ Concerns & Recommendations

3. Layout Nesting Complexity

Location: src/app/layout.tsx:30-35

You're now wrapping ALL routes with DocsLayout, including the (home) route group which has its own HomeLayout. This creates:

RootProvider → DocsLayout → (home group) → HomeLayout

Issue: Double layout wrapping may cause:

  • Unexpected styling conflicts
  • Navigation issues
  • Sidebar appearing on home page when it shouldn't

Recommendation: Consider using route groups to apply different layouts:

  • (docs)/[[...slug]]/ → gets DocsLayout
  • (home)/ → gets HomeLayout only

4. Import Order Changes ℹ️

The PR makes consistent changes to import order (external → internal, alphabetical). While this is good for consistency, consider:

  • Using an ESLint plugin or Biome rule to enforce this automatically
  • The changes add noise to the diff without functional impact

5. Type-only Imports

Good changes like import type * as PageTree improve build performance. Consider applying this pattern consistently across the codebase.


🧪 Testing Recommendations

Since there are no test files in this repository:

  1. Manual testing checklist:

    • Verify / loads the correct page (home or docs?)
    • Test all internal links work with new URL structure
    • Check that /docs returns 404 or redirects appropriately
    • Verify OG images generate correctly
    • Test search functionality with new base URL
    • Check favicon appears in all browsers
  2. Build verification:

    npm run build

    Ensure no route conflicts are reported


🔒 Security

No security concerns identified. The changes are purely structural.


📊 Performance

  • Positive: Reduced layout nesting should slightly improve render performance
  • Positive: Type-only imports reduce bundle size marginally
  • Neutral: Route structure change has no performance impact

🎯 Recommendations

Before merging:

  1. MUST FIX: Resolve the route conflict between (home)/page.tsx and [[...slug]]/page.tsx
  2. MUST VERIFY: Test that / loads the intended page
  3. SHOULD FIX: Review OG image URL generation
  4. SHOULD CONSIDER: Restructure route groups to avoid double layout wrapping

After merging:

  1. Add automated tests for routing behavior
  2. Set up linting rules for import ordering
  3. Consider adding a redirect from /docs/* to /* for backward compatibility

📝 Code Quality Score

  • Architecture: 7/10 (good intent, but route conflict issue)
  • Code Style: 9/10 (consistent, clean)
  • Documentation: 6/10 (good PR description, but no inline comments for complex logic)
  • Testing: 2/10 (no tests)

Overall: Good refactoring idea with a critical routing issue that must be fixed before merge.


🤖 Generated with Claude Code

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