Documentation

Guides and references

Programmatic SEO

Programmatic SEO

Templates, pages.json, link graph, and PSEO routes.

Overview

Programmatic SEO lets you generate many pages from templates and data. Use cases:

  • Location pages (e.g. "Plumber in [City]")
  • Comparison pages
  • How-to guides
  • Tool pages
  • Hub pages
Live pSEO page — NextBento vs ShipFast comparison

Templates

lib/pseo/templates.ts — Template configs:

TemplateLabelMin WordsMin FAQs
hubHub4003
toolTool5004
comparisonComparison6004
howtoHow-to7005
locationLocation5003

pages.json

Page data lives in content/pseo/pages.json:

{
  "pages": [
    {
      "id": "unique-id",
      "slug": "page-slug",
      "template": "hub",
      "intent": "informational",
      "primaryKeyword": "main keyword",
      "supportingKeywords": ["kw1", "kw2"],
      "title": "Page Title",
      "description": "Meta description",
      "headings": ["H2", "H3"],
      "sections": [{ "title": "Section", "body": "Content..." }],
      "faqs": [{ "question": "Q?", "answer": "A" }],
      "hubId": null,
      "relatedIds": [],
      "schemaTypes": ["Article", "FAQPage"],
      "lastModified": "2024-01-15"
    }
  ]
}

Route

app/(pseo)/[template]/[slug]/page.tsx:

  • Renders pages from pages.json by template + slug
  • Uses getPseoPageBySlug(template, slug) from lib/pseo/data.ts
  • Layout uses LandingHeader and LandingFooter

lib/pseo/link-graph.ts:

  • getHubPage(page) — Parent hub for a page
  • getSiblingPages(page) — Siblings under same hub
  • getRelatedPages(page) — Related by relatedIds
  • buildBreadcrumbs(page) — Breadcrumb list for schema

Use these for internal linking and breadcrumbs on PSEO pages.

Validation

lib/pseo/validation.ts — Validates pages.json against template config (word count, FAQ count, etc.). Run pnpm validate:pseo in the product repo to check.

This marketing site has a separate check: pnpm validate:pseo in nextbento-landing. It fails if a comparison, integration, glossary, or persona page is missing Quick Answer / Decision Criteria / Evidence / Best For, has fewer than 3 FAQs, or has dateModified older than 180 days.

Sitemap

PSEO pages are included in sitemap segments /sitemaps/pseo-{template}. Add new pages to pages.json and they appear in the sitemap.

Live examples on nextbento.dev

This marketing site ships working pSEO pages you can study or link to:

Each detail page includes a Related pages block linking to pricing, docs, and sibling pages — see lib/pseo/link-graph.ts on the landing repo.