Programmatic SEO
Generate hundreds of SEO-optimized pages from JSON data at build time using generateStaticParams.
Generate hundreds of landing pages from structured JSON data. Perfect for "[Tool] alternatives", "[City] guides", and "[Topic] resources" pages. All pages are statically generated at build time (SSG).
How It Works
- Data lives in JSON files under
content/programmatic/ - Route at
app/(marketing)/p/[slug]/page.tsxrenders each page generateStaticParams()pre-builds all pages at build time- Each page gets unique
<title>, meta description, and JSON-LD structured data
Files
lib/features/programmatic-seo.ts — loadCollection(), getPage(), getAllPages()
components/features/programmatic-seo/
page-template.tsx — Page template component
content/programmatic/
alternatives.json — Sample data (3 pages)
app/(marketing)/p/[slug]/page.tsx — Route handler with generateStaticParamsSetup
Create your data file
Create content/programmatic/alternatives.json:
[
{
"slug": "slack-alternatives",
"title": "10 Best Slack Alternatives in 2026",
"description": "Looking for Slack alternatives? Compare the top 10...",
"h1": "Best Slack Alternatives",
"content": "Slack has been the go-to team communication tool...",
"category": "Team Communication",
"items": [
{
"name": "Discord",
"description": "Originally built for gamers...",
"pricing": "Free / Nitro $9.99/mo",
"url": "https://discord.com"
}
],
"relatedSlugs": ["notion-alternatives"]
}
]Build to generate pages
pnpm buildPages are generated at /p/{slug} — e.g., /p/slack-alternatives.
Customize the template
Edit components/features/programmatic-seo/page-template.tsx to match your design, update layout/typography, and modify the JSON-LD schema for your content type.
Add more collections
Create additional JSON files in content/programmatic/ — e.g., cities.json, tools.json, resources.json. All collections are loaded automatically by getAllPages().
Data Schema
Required fields
| Field | Type | Description |
|---|---|---|
slug | string | URL path (e.g., "slack-alternatives") |
title | string | <title> tag |
description | string | Meta description |
h1 | string | Main heading |
content | string | Intro paragraph |
Optional fields
| Field | Type | Description |
|---|---|---|
category | string | Category badge |
items | array | List items to display (name, description, pricing, url) |
relatedSlugs | string[] | Slugs of related pages |
Custom fields are accessible in the template via page.customField.
Tips
- All pages are statically generated — zero runtime cost per request
- Pages are automatically included in Next.js sitemap generation
- Build time scales linearly with the number of items — hundreds of pages add only seconds to the build