Metadata
apps/web/lib/seo.ts builds page metadata from your environment:
| Helper | Returns |
|---|---|
getSiteUrl() | NEXT_PUBLIC_URL without a trailing slash |
getSiteName() | NEXT_PUBLIC_SAAS_NAME |
getSiteDescription() | NEXT_PUBLIC_SITE_DESCRIPTION |
getCanonicalUrl(path) | The absolute canonical URL for a path |
createSeoMetadata({ title, description, pathname }) | A Metadata object with title, description, canonical URL, Open Graph and Twitter card |
The root layout sets metadataBase and the site-wide defaults. Public pages add their own:
import type { Metadata } from "next";
import { createSeoMetadata } from "@/lib/seo";
export const metadata: Metadata = createSeoMetadata({
title: "Pricing",
description: "Plans for teams of every size.",
pathname: "/landing/pricing",
});
Dynamic pages use generateMetadata, as app/landing/doc/[slug]/page.tsx does for each doc. The default Open Graph image is /cms/hero_0.png; replace it or pass your own.
Sitemap
app/sitemap.ts lists the public static routes (PUBLIC_SEO_STATIC_ROUTES in lib/seo.ts: the landing page, legal pages, sign-in and sign-up) and every documentation page from your CMS. Doc pages are marked weekly, others monthly, and /landing has the highest priority. Add new public routes to PUBLIC_SEO_STATIC_ROUTES.
robots.txt
app/robots.ts allows /landing, /landing/doc, /landing/legal, /sign-in and /sign-up, disallows /admin, /api and the auth callback and recovery pages, and points to the sitemap. Signed-in pages are not crawlable anyway, because the middleware redirects visitors without a session.
The SEO audit
Admin → SEO → Audit checks every public page and doc page for a title, a meta description, a canonical URL and a clean heading hierarchy, and checks that robots.txt and sitemap.xml respond. With GOOGLE_PAGESPEED_API_KEY it adds PageSpeed Insights performance scores. Create the key in the Google Cloud Console with the PageSpeed Insights API enabled.
Checklist before launch
- Set
NEXT_PUBLIC_URLto the production domain. Canonical URLs, the sitemap and Open Graph URLs all use it. - Write a real
NEXT_PUBLIC_SITE_DESCRIPTION(150–160 characters). - Replace the Open Graph image and the favicon.
- Submit
https://your-domain.com/sitemap.xmlin Google Search Console. - Run the admin SEO audit and fix every failing check.
