The App Router has good SEO tools built in, but they are spread over several files and it is easy to get one of them slightly wrong. This is the setup I use on the EventsIQ public site, which has a few hundred pages: features, integrations, docs, a glossary and a blog.
There are four pieces:
Metadata for each page: title, description, canonical URL and share card.
sitemap.ts : every page you want found.
robots.ts : what crawlers may fetch.
JSON-LD : structured data that tells Google what a page is.
1. One helper for every page's metadata
Each page exports metadata or generateMetadata . Rather than repeat the same fields everywhere, I use one helper:
import type { Metadata } from "next" ;
export function pageMetadata ( input : { title : string ; description : string ; path : string ; type ?: "website" | "article" ; publishedTime ?: string ; } ) : Metadata { const image = `/api/og?${new URLSearchParams({ title: input.title })}` ; return { title : input . title , description : input .…