Skip to content

feat(landing): serve the landing page at /home for everyone - #39

Merged
pulkitxm merged 2 commits into
mainfrom
feat/home-landing
Jul 24, 2026
Merged

feat(landing): serve the landing page at /home for everyone#39
pulkitxm merged 2 commits into
mainfrom
feat/home-landing

Conversation

@pulkitxm

@pulkitxm pulkitxm commented Jul 24, 2026

Copy link
Copy Markdown
Member

Serve the landing page at /home so signed-in users can reach it too, sharing metadata with the root route.

Greptile Summary

This PR extracts the landing page metadata into a shared landing-meta.ts module and adds a /home route so authenticated users (who are redirected away from /) can still reach the landing page.

  • Metadata extraction: landingMetadata(canonicalPath) and landingStructuredData() are pulled into apps/web/src/features/landing/landing-meta.ts, eliminating the inline duplication that existed in app/page.tsx.
  • New /home route: apps/web/src/app/home/page.tsx renders the landing page with landingMetadata('/'), setting the canonical and Open Graph URL to / so search engines consolidate ranking on the root and not /home. /home is excluded from the sitemap.
  • Tests: landing-meta.test.ts verifies that the canonical is an absolute URL, the page is indexable, and the Open Graph URL matches the canonical.

Confidence Score: 5/5

Safe to merge. The change is a clean metadata extraction with a new unauthenticated-accessible route, no auth or data-handling paths are touched.

The refactor is mechanical: inline metadata moves to a dedicated module consumed identically by both routes. The /home route adds no new session logic, shares the same canonical URL as /, and is excluded from the sitemap. Tests cover the key invariants.

No files require special attention.

Important Files Changed

Filename Overview
apps/web/src/features/landing/landing-meta.ts New shared module exporting landingMetadata and landingStructuredData; correctly uses absoluteUrl to produce canonical and OG URLs from a given path
apps/web/src/app/home/page.tsx New /home route serving the landing page; passes '/' to landingMetadata so the canonical points to root, preventing SEO signal dilution
apps/web/src/app/page.tsx Refactored to use shared landingMetadata/landingStructuredData; auth redirect and rendering logic unchanged
apps/web/src/features/landing/landing-meta.test.ts Tests using bun:test verify canonical is absolute, page is indexable, OG URL matches canonical, and structured data describes a free software application

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User visits /] --> B{Authenticated?}
    B -- yes --> C[redirect to /my-issues]
    B -- no --> D[Render LandingPage with canonical /]

    E[User visits /home] --> F[Render LandingPage with canonical /]

    G[landingMetadata called with path /] --> H[absoluteUrl builds absolute root URL]
    H --> I[alternates.canonical = absolute root]
    H --> J[openGraph.url = absolute root]

    D & F -.->|both use| G
    K[Sitemap] --> L[Only / is listed]
Loading

Reviews (2): Last reviewed commit: "fix(landing): canonicalise /home to the ..." | Re-trigger Greptile

Context used:

  • Context used - CLAUDE.md (source)

Share the landing metadata and structured data between the root and a new /home
route so signed-in users can reach the marketing page directly, and list /home
in the sitemap.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Shared landing-page metadata and JSON-LD helpers are added, the root and /home routes use them, /home is added to the sitemap, and tests validate canonical metadata and structured-data output.

Changes

Landing SEO

Layer / File(s) Summary
Shared landing metadata utilities
apps/web/src/features/landing/landing-meta.ts, apps/web/src/features/landing/landing-meta.test.ts
Adds reusable SEO metadata and SoftwareApplication JSON-LD generators with tests for canonical URLs, robots directives, offers, and feature lists.
Home route and sitemap integration
apps/web/src/app/page.tsx, apps/web/src/app/home/page.tsx, apps/web/src/app/sitemap.ts
Routes use shared metadata and structured data helpers, and the /home URL is added to the sitemap.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • Noveum/orbit#28: Refactors the root page to use the shared landing SEO and JSON-LD helpers.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the new /home landing-page route and matches the main change.
Description check ✅ Passed The description accurately matches the /home landing page and shared metadata refactor.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/home-landing

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

Comment thread apps/web/src/app/home/page.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (2)
apps/web/src/features/landing/landing-meta.test.ts (1)

14-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid leaking any from JSON.parse.

JSON.parse infers data as any, bypassing the strict typing requirement. Parse the payload through a small Zod schema before accessing its fields.

As per coding guidelines, **/*.{ts,tsx} must use strict types and must not use any.

Suggested adjustment
+import { z } from 'zod';
+
+const structuredDataSchema = z.object({
+  '`@type`': z.literal('SoftwareApplication'),
+  offers: z.object({ price: z.string() }),
+  featureList: z.array(z.string()),
+});
...
-    const data = JSON.parse(landingStructuredData());
+    const data = structuredDataSchema.parse(JSON.parse(landingStructuredData()));
🤖 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 `@apps/web/src/features/landing/landing-meta.test.ts` around lines 14 - 17,
Update the test around landingStructuredData to validate the parsed payload
through a small Zod schema before accessing `@type`, offers.price, and
featureList. Replace the direct JSON.parse result with the schema-validated
typed value, ensuring no any escapes into the test while preserving the existing
assertions.

Source: Coding guidelines

apps/web/src/app/page.tsx (1)

6-6: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Normalize both route metadata URLs through absoluteUrl().

landingMetadata() copies its canonical argument directly into alternates.canonical and openGraph.url, but both callers pass relative paths. Unless an app-level metadataBase is guaranteed, verify or change these calls so generated metadata always uses the validated public origin.

  • apps/web/src/app/page.tsx#L6-L6: pass absoluteUrl('/') to landingMetadata().
  • apps/web/src/app/home/page.tsx#L4-L4: pass absoluteUrl('/home') to landingMetadata().

Based on learnings, public metadata URLs in apps/web/src should use absoluteUrl() so they share the validated, normalized public origin.

🤖 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 `@apps/web/src/app/page.tsx` at line 6, Normalize both landing metadata URLs
through absoluteUrl: update the landingMetadata call in
apps/web/src/app/page.tsx at line 6 to pass absoluteUrl('/') and the call in
apps/web/src/app/home/page.tsx at line 4 to pass absoluteUrl('/home'), ensuring
both canonical and Open Graph URLs use the validated public origin.

Source: Learnings

🤖 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 `@apps/web/src/features/landing/landing-meta.ts`:
- Line 2: Update landingMetadata to build canonical and Open Graph URLs with
absoluteUrl(canonical), and build the JSON-LD URL with absoluteUrl('/'); remove
the direct publicAppUrl() usage/import. Update landing-meta.test.ts assertions
to expect the resolved absolute URLs while preserving the existing route-path
input behavior.

---

Nitpick comments:
In `@apps/web/src/app/page.tsx`:
- Line 6: Normalize both landing metadata URLs through absoluteUrl: update the
landingMetadata call in apps/web/src/app/page.tsx at line 6 to pass
absoluteUrl('/') and the call in apps/web/src/app/home/page.tsx at line 4 to
pass absoluteUrl('/home'), ensuring both canonical and Open Graph URLs use the
validated public origin.

In `@apps/web/src/features/landing/landing-meta.test.ts`:
- Around line 14-17: Update the test around landingStructuredData to validate
the parsed payload through a small Zod schema before accessing `@type`,
offers.price, and featureList. Replace the direct JSON.parse result with the
schema-validated typed value, ensuring no any escapes into the test while
preserving the existing assertions.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7c42d20e-0d0b-4f6c-b428-85ed3db50805

📥 Commits

Reviewing files that changed from the base of the PR and between d4c7754 and 3093b77.

📒 Files selected for processing (5)
  • apps/web/src/app/home/page.tsx
  • apps/web/src/app/page.tsx
  • apps/web/src/app/sitemap.ts
  • apps/web/src/features/landing/landing-meta.test.ts
  • apps/web/src/features/landing/landing-meta.ts

Comment thread apps/web/src/features/landing/landing-meta.ts Outdated
Point the /home canonical and open graph url at the absolute root so the alias
does not split search ranking, build every SEO url through absoluteUrl, and drop
/home from the sitemap since it canonicalises to /.
@pulkitxm
pulkitxm merged commit b867a57 into main Jul 24, 2026
6 checks passed
@pulkitxm
pulkitxm deleted the feat/home-landing branch July 24, 2026 05:52
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