Skip to content

[Chore]: metadataBase env name, OG image parity, baseUrl canonical #62

Description

@martyy-code

Task Description

Three small SEO-housekeeping fixes grouped into one chore because each is a single-site config line that doesn't deserve its own issue:

  1. apps/web/src/app/layout.tsxmetadataBase reads process.env.NEXT_PUBLIC_SITE_URL || baseUrl. The repo's .env.example declares NEXT_PUBLIC_APP_URL, not NEXT_PUBLIC_SITE_URL. Fix the env name (or read both) so production doesn't accidentally fall back to the wrong base.

  2. apps/web/src/app/docs/[[...slug]]/page.tsxgenerateMetadata currently sets only openGraph.images: getPageImage(page).url. The home and blog equivalents include width, height, and alt. Add those three fields for parity.

  3. apps/web/src/app/(home)/page.tsxalternates.canonical is the hard-coded string 'https://errors.deessejs.com'. Everywhere else in the codebase canonical URLs are built from baseUrl (import { baseUrl } from '@/lib/shared'). Replace the hard-coded string with baseUrl so a future domain change picks up everywhere at once.

Motivation / Why

  • Drift between the code's expected env var name and .env.example is a deploy-time footgun (Next silently falls back to baseUrl, but environment-vars-mismatch is what bites the next maintainer).
  • OG image parity prevents social previews from looking broken on doc links specifically.
  • Centralising baseUrl keeps canonical URLs consistent through any future domain migration.

In Scope

  • apps/web/src/app/layout.tsx — align NEXT_PUBLIC_* env name with .env.example.
  • apps/web/src/app/docs/[[...slug]]/page.tsx — fill in OG image width/height/alt in generateMetadata.
  • apps/web/src/app/(home)/page.tsx — use baseUrl for alternates.canonical.
  • apps/web/.env.example — either rename NEXT_PUBLIC_APP_URLNEXT_PUBLIC_SITE_URL or document why both exist (recommended: rename to match the code).

Out of Scope

  • Changing baseUrl itself in apps/web/src/lib/shared.ts.
  • Renaming any exported env var in the package code (these are site-only).
  • Updating OG image generators (opengraph-image.tsx, twitter-image.tsx, og/**/route.tsx).
  • Touching the JSON-LD bugs handled separately in the JSON-LD bug issue.

User-Facing Impact

  • No user-facing impact - internal/tooling/maintenance only

Component(s) Affected

  • Multiple Components (specifically apps/web/src/app/layout.tsx, apps/web/src/app/docs/[[...slug]]/page.tsx, apps/web/src/app/(home)/page.tsx, and apps/web/.env.example)

Priority

  • p3: Low - Nice to have, can wait

Estimated Effort

  • effort: xs - Few minutes

Related Issues / Pull Requests

  • Sibling issue: [Chore]: disallow /llms-full.txt in robots.ts (same audit batch).
  • Sibling issue: [Refactor]: source sitemap lastModified from real timestamps (same audit batch).
  • Sibling issue: [BUG]: JSON-LD assemblyVersion / datePublished / operatingSystem are wrong (same audit batch).

Relevant Documentation

  • docs/internal/tasks/v1.4.x-seo-cleanup.md — full audit and the batch this chore belongs to.
  • apps/web/.env.example — current env declaration that disagrees with layout.tsx.

Technical Approach

Implementation approach:

  1. For layout.tsx, change the env lookup to match the .env.example filename. If renaming .env.example, do both atomically.
  2. For the doc generateMetadata, lift the home's OG image tuple shape (url + width: 1200 + height: 630 + alt: '<page title>') into the doc metadata.
  3. For the home canonical, replace the hard-coded URL string with the imported baseUrl.

Files that may need changes:

  • apps/web/src/app/layout.tsx
  • apps/web/src/app/docs/[[...slug]]/page.tsx
  • apps/web/src/app/(home)/page.tsx
  • apps/web/.env.example

Constraints / considerations:

  • Renaming the env var requires updating any production deployment that sets it under the old name; flag this in the PR description.
  • Keep the OG image dimensions consistent at 1200×630 to match the existing image generators.

Risk Assessment

Risk: renaming an env var breaks production builds that still set the old name.
Mitigation: announce the rename in the PR body and in the next release notes; treat it as a one-deploy coordinated change.
Rollback plan: revert .env.example and layout.tsx simultaneously.

Pre-Submission Checklist

  • Task description clearly defines the end state
  • Scope (in/out) is clearly defined
  • Component(s) affected are specified
  • I have searched for existing issues covering this work
  • I understand this issue will be labeled according to the project taxonomy
  • Note: type: chore is a project-specific label for general maintenance tasks not covered by the standard type labels (bug, feature, refactor, docs, security)

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: xsA few minutesp3: lowNice to havestatus: readyValidated by Tech Lead, ready to pick uptype: choreGeneral maintenance tasks

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions