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:
-
apps/web/src/app/layout.tsx — metadataBase 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.
-
apps/web/src/app/docs/[[...slug]]/page.tsx — generateMetadata currently sets only openGraph.images: getPageImage(page).url. The home and blog equivalents include width, height, and alt. Add those three fields for parity.
-
apps/web/src/app/(home)/page.tsx — alternates.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_URL → NEXT_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
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
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:
- For
layout.tsx, change the env lookup to match the .env.example filename. If renaming .env.example, do both atomically.
- For the doc
generateMetadata, lift the home's OG image tuple shape (url + width: 1200 + height: 630 + alt: '<page title>') into the doc metadata.
- 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
Three small SEO-housekeeping fixes grouped into one chore because each is a single-site config line that doesn't deserve its own issue:
apps/web/src/app/layout.tsx—metadataBasereadsprocess.env.NEXT_PUBLIC_SITE_URL || baseUrl. The repo's.env.exampledeclaresNEXT_PUBLIC_APP_URL, notNEXT_PUBLIC_SITE_URL. Fix the env name (or read both) so production doesn't accidentally fall back to the wrong base.apps/web/src/app/docs/[[...slug]]/page.tsx—generateMetadatacurrently sets onlyopenGraph.images: getPageImage(page).url. The home and blog equivalents includewidth,height, andalt. Add those three fields for parity.apps/web/src/app/(home)/page.tsx—alternates.canonicalis the hard-coded string'https://errors.deessejs.com'. Everywhere else in the codebase canonical URLs are built frombaseUrl(import { baseUrl } from '@/lib/shared'). Replace the hard-coded string withbaseUrlso a future domain change picks up everywhere at once.Motivation / Why
.env.exampleis a deploy-time footgun (Next silently falls back tobaseUrl, but environment-vars-mismatch is what bites the next maintainer).baseUrlkeeps canonical URLs consistent through any future domain migration.In Scope
apps/web/src/app/layout.tsx— alignNEXT_PUBLIC_*env name with.env.example.apps/web/src/app/docs/[[...slug]]/page.tsx— fill in OG imagewidth/height/altingenerateMetadata.apps/web/src/app/(home)/page.tsx— usebaseUrlforalternates.canonical.apps/web/.env.example— either renameNEXT_PUBLIC_APP_URL→NEXT_PUBLIC_SITE_URLor document why both exist (recommended: rename to match the code).Out of Scope
baseUrlitself inapps/web/src/lib/shared.ts.opengraph-image.tsx,twitter-image.tsx,og/**/route.tsx).User-Facing Impact
Component(s) Affected
apps/web/src/app/layout.tsx,apps/web/src/app/docs/[[...slug]]/page.tsx,apps/web/src/app/(home)/page.tsx, andapps/web/.env.example)Priority
Estimated Effort
Related Issues / Pull Requests
[Chore]: disallow /llms-full.txt in robots.ts(same audit batch).[Refactor]: source sitemap lastModified from real timestamps(same audit batch).[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 withlayout.tsx.Technical Approach
Implementation approach:
layout.tsx, change the env lookup to match the.env.examplefilename. If renaming.env.example, do both atomically.generateMetadata, lift the home's OG image tuple shape (url+width: 1200+height: 630+alt: '<page title>') into the doc metadata.baseUrl.Files that may need changes:
apps/web/src/app/layout.tsxapps/web/src/app/docs/[[...slug]]/page.tsxapps/web/src/app/(home)/page.tsxapps/web/.env.exampleConstraints / considerations:
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.exampleandlayout.tsxsimultaneously.Pre-Submission Checklist