FlagshipPre-alpha · planned APINext.js 16 · MIT

next-heraldSEO, native. For the Next.js 16 App Router.

Typed metadata, safe JSON-LD, sitemaps with hreflang, OG templates and an SEO CI check for the Next.js 16 App Router. Built on native Next APIs, zero dependencies beyond next and react.

npm install next-herald # not yet published

Not published to npm yet. No library code exists; everything here is the planned API from the README and design docs, open for feedback.

pageMetadata(herald, { … }) · preview

example.com › blog › app-router-seo

Shipping SEO in the App Router · Example

    <JsonLd> output · < > & escaped

    Illustration of documented behaviour (title template %s · Example, canonical normalisation, dev warnings over 70/160 characters, ADR 0004 escaping) running in your browser. next-herald is not published yet.

    01 · The problem

    SEO moved into Next itself.

    The App Router moved SEO into Next itself (generateMetadata, sitemap.ts, robots.ts, opengraph-image). The popular packages come from the Pages Router era.

    next-sitemap

    Writes files to public/ in a postbuild step. Last release 4.2.3 in September 2023; on Next 16 + Vercel those files are not deployed.

    next-seo

    Maintained, but in the App Router it now recommends native generateMetadata for meta tags and focuses on JSON-LD components.

    Native Next.js

    Covers the basics but has no sitemap index, no news sitemaps, shallow metadata merging, a JSON-LD guide that warns JSON.stringify is not XSS-safe, and no way to check a build.

    A Next.js 16 App Router–only SEO kit that returns native Metadata, MetadataRoute.Sitemap/Robots and ImageResponse objects, fills the gaps Next leaves, and ships herald check, a dependency-free CI crawler for technical SEO mistakes. It makes no ranking or AI-citation claims and no performance claims.

    02 · How it works

    Native objects in, a crawler to check what shipped.

    1

    One validated config

    defineHerald in herald.config.ts is validated and frozen: siteUrl, title template, defaults, i18n, entity.

    2

    Native objects out

    Entry points for metadata, jsonld, sitemap, robots and og return Metadata, MetadataRoute and ImageResponse objects. Next renders the <head>.

    3

    Crawl what shipped

    herald check fetches a running server or reads a static export, scans the head, builds a page model and runs pure rules into pretty, json, github or sarif reporters.

    How next-herald fits into Next.jsherald.config.ts is validated by defineHerald, then the metadata, jsonld, sitemap, robots and og entry points return native objects that Next renders. herald check fetches a server or reads a static export, scans the head, builds a page model, runs rules and writes reports. herald.config.tsdefineHerald · validated, frozen next-herald/metadata next-herald/jsonld next-herald/sitemap next-herald/robots next-herald/og Metadata → Next renders <head> <script type=application/ld+json> · escaped MetadataRoute.Sitemap | XML (index, news) MetadataRoute.Robots next/og ImageResponse herald checkfetch | fs (out/)head scannerpage modelrulesreporters
    Based on docs/architecture.md (planned design).

    Design principles

    1. Native first. Return objects Next renders; never render our own <head> tags. ADR 0001
    2. Zero dependencies. Only the next and react peers; the CLI uses Node built-ins. Enforced in CI. ADR 0002
    3. Static by default. Never read headers or cookies, so pages stay in the Cache Components static shell. ADR 0006
    4. Safe by default. JSON-LD is escaped; previews are noindex unless built for production. ADR 0004
    5. Check what crawlers see. herald check reads served HTML, not Next internals. ADR 0008

    03 · Features planned

    Everything in the README, nothing more.

    Typed metadata builders

    createMetadata for site defaults, pageMetadata for canonical and OG/Twitter, mergeMetadata for a deep merge, since Next merges per top-level key.

    Typed, XSS-safe JSON-LD

    Builders for common schema.org types with Google-required fields enforced by TypeScript, a <JsonLd> Server Component and an entity graph by default.

    Sitemaps from app/ routes

    herald routes scans app/; defineSitemap requires a typed params enumerator for every dynamic route. Image, video and language alternates.

    Large sites

    Split at 50,000 URLs / 50 MB with a generated sitemap index; Google News sitemaps.

    Robots with AI crawlers by purpose

    robots.ts with automatic sitemap lines, preview lock-down and AI-crawler rules split into training / search / user-fetch; search allowed by default.

    hreflang

    Reciprocal alternates and x-default from one I18nSource; optional next-tongue adapter, recipes for next-intl and Paraglide.

    OG image templates

    Typed JSX templates on next/og ImageResponse, no bundled fonts.

    herald check

    Crawls a running server or a static export for title, description, canonical, hreflang, noindex, sitemap/robots and structured-data mistakes, with pretty, json, GitHub annotations and SARIF output.

    SEO preview panel (v0.3)

    A next dev overlay with the Google result snippet, OG/X cards and a chat link preview, plus live herald check warnings. Stripped from production.

    Redirect manager (v0.3)

    Typed redirect rules for next.config or proxy.ts, with checks for chains, loops and temporary redirects where permanent ones are intended.

    herald check --diff (v0.4)

    Compares SEO output with a base snapshot or branch and reports only changes as markdown or SARIF for PR comments.

    Cache Components and static export safe

    Pure builders; works with cacheComponents: true and output: 'export'.

    04 · Quick start planned API

    From install to typed output.

    // herald.config.ts
    import { defineHerald } from 'next-herald/config';
    
    export default defineHerald({
      siteUrl: 'https://example.com',
      siteName: 'Example',
      title: { default: 'Example', template: '%s · Example' },
      description: 'What Example does, in one sentence.',
    });

    Full walkthrough: Getting started · API reference · CLI

    05 · Configuration

    herald.config.ts reference

    OptionTypeDefaultNotes
    siteUrlstring— (required)Absolute origin, https: (or http://localhost). Becomes metadataBase. Read at build time, never from headers.
    siteNamestring—og:site_name, WebSite JSON-LD.
    title{ default, template }—template must contain %s; validated.
    descriptionstring—Default description; herald check warns on duplicates anyway.
    localestring'en'og:locale (BCP 47, converted to en_US-style for OG).
    openGraphMetadata['openGraph']{}Merged into every page.
    twitter{ site?, creator?, card? }card: 'summary_large_image'
    trailingSlashbooleanfrom next.configMust match next.config; herald check flags canonicals that redirect.
    i18nI18nSource—See hreflang & i18n.
    indexing'auto' | 'on' | 'off''auto'auto: off unless HERALD_ENV=production (or VERCEL_ENV=production). When off, every page gets robots: noindex.
    organization / person{ name, url?, … sameAs? }—Publisher entity for the default graph. Mutually exclusive. v0.2.
    indexNow{ key?, keyPath?, endpoint? }—Used by herald indexnow only (CLI, v0.5).
    app{ dir?, pageExtensions? }{ dir: 'app' }Used by herald routes. Supports src/app.
    checkCheckConfig—Rule severities, thresholds, ignore globs.

    Abridged. Full reference in docs/configuration.md.

    06 · FAQ

    Straight answers.

    From docs/faq.md. Something missing? Open an issue.

    Why not just use native generateMetadata?

    You should — next-herald returns native objects. It adds config-wide defaults, deep merging across segments, canonical/hreflang generation, safe JSON-LD, sitemap index/news, and a CI check. If you need none of that, native APIs are enough.

    Does it improve rankings or speed?

    No such claim. It helps you avoid technical SEO mistakes; rankings depend on much more. Bundle-size numbers will be published with reproducible scripts (v0.5).

    Will it get my site cited by ChatGPT, Perplexity or AI Overviews?

    No such claim, and no "GEO score". It checks the things engines document: server-rendered content, AI search bots allowed, accurate dates, consistent entity markup. llms.txt and markdown alternates are experimental opt-ins with no proven benefit.

    Does blocking Google-Extended keep me out of AI Overviews?

    No. AI Overviews and AI Mode use Googlebot; Google-Extended only covers Gemini/Vertex training and grounding. Use nosnippet, max-snippet or noindex.

    Does herald check run JavaScript?

    No. It reads server HTML, like many crawlers' first pass.

    Do I need next-tongue?

    No. Any i18n setup works through I18nSource.

    Does it support the Pages Router or Next 15?

    No. Keep next-seo / next-sitemap there.

    07 · Roadmap

    Where it's going.

    1. v0.1

      Core builders, ship fast: config, metadata builders, <JsonLd> + 7 types, basic sitemap/robots, CI with dependency budget

      next up
    2. v0.2

      herald check core (titles, descriptions, canonicals, noindex, sitemap/robots, no-JS visibility, links, Lighthouse-equivalent basics, AI-crawler robots) + herald routes + entity graph

    3. v0.3

      Large sites & i18n: sitemap index, news, hreflang, next-tongue adapter, static export, accurate lastmod

    4. v0.4

      OG templates, JSON-LD, OG, citation-friendly structure and entity rules, more schema types, SARIF

    5. v0.5

      herald init, herald indexnow, verified migration guides, published size/perf report, AI referral docs; experimental markdown alternates and llms.txt

    6. v0.9

      Beta: API and rule-ID freeze

    7. v1.0

      Stable, semver guarantees

    8. post-1.0

      next-seo / next-sitemap codemods

    Scope freeze: no new features before v0.1 ships. Acceptance criteria in ROADMAP.md.

    Support this project

    Support open-source security tools

    I build free, open-source tools that help developers ship safer websites. Every coffee helps keep them maintained, documented and free for everyone.

    Buy me a coffee (opens Stripe in a new tab)

    Secure checkout by Stripe

    Portrait of Louis Wright

    About the author

    Louis Wright

    Cyber security researcher and software engineer based in the UK.

    More tools by Louis Wright

    58 tools

    Sentinels security scanners & CI gates · 20