Astro vs Next.js for Programmatic SEO: which should you choose?
Astro for programmatic SEO: islands, getStaticPaths(), a TypeScript example, an Astro vs Next.js table and how to avoid thin content.
By Shakir Sajad · 6 min read · Updated 2026-11-25

I'm a founder who builds sites that generate many pages from data. This site is a Vite and React app that is prerendered to HTML at build time, so I think about this trade-off a lot. Below is how I'd choose between Astro and Next.js for programmatic SEO, with code. I haven't run benchmarks, so the comparison is about design, not speed numbers.
What programmatic SEO is
Programmatic SEO (pSEO) means building many pages from one template and a dataset. Each row becomes a page.
Common examples:
- A directory of tools, one page per tool.
- A comparison site, one page per "X vs Y".
- A browser games site, one page per game.
- A city or location guide, one page per place.
If you want the strategy first, read Programmatic SEO for startups and the mistakes I made. This guide is about the tech.
What Astro is, and how it differs from Next.js
Astro is a web framework for content-driven sites. By its own docs, it renders pages to HTML on the server, at build time or request time, and ships no JavaScript to the browser unless you ask for it.
Next.js is a React framework. It can also output static HTML, and it can render on the server per request. It is built to support full apps too, so it carries more machinery.
| Astro | Next.js | |
|---|---|---|
| Main idea | Content first, HTML by default | React app first, with server rendering |
| Default JavaScript | None unless you add it | React runtime for interactive parts |
| Page data at build | getStaticPaths() | generateStaticParams() |
| UI library | Any, or none | React |
Why Astro suits content-heavy sites
A pSEO page is mostly text, tables and links. It rarely needs a client-side app. Astro's default fits that:
- The HTML crawlers fetch already contains your content.
- Pages have little JavaScript to download and run.
- You can mix in React, Svelte or Vue only where a widget needs it.
- Markdown, JSON and CSV data are first-class citizens.
Google can render JavaScript, but giving it finished HTML removes one step where things can go wrong.
Islands architecture in plain words
Think of a page as a sea of static HTML with a few "islands" of interactivity. A search box or a chart can be an island. The rest of the page stays plain HTML.
In Astro, you mark an island with a directive:
<SearchBox client:visible />client:visible loads that component's JavaScript only when it scrolls into view. Other directives include client:load and client:idle. A component with no directive renders to HTML and sends no JavaScript at all. This is how Astro reduces client-side JavaScript.
How getStaticPaths() makes thousands of pages
In a static Astro site, a dynamic route like src/pages/tools/[slug].astro must tell Astro which pages to build. getStaticPaths() returns a list, one entry per page. Each entry has params (the URL parts) and optional props (data for the template).
The list can come from anywhere your build can read:
- A JSON file in the repo.
- A CSV parsed at build time.
- A database such as Supabase.
- Markdown files.
Here is a working example with a JSON file and a quality gate:
---
// src/pages/tools/[slug].astro
import type { GetStaticPaths } from 'astro';
import tools from '../../data/tools.json';
interface Tool {
slug: string;
name: string;
summary: string;
pricing: string;
bestFor: string;
source: string;
}
export const getStaticPaths = (() => {
return (tools as Tool[])
// Publish rule: skip rows with missing facts
.filter((t) => t.summary && t.pricing && t.bestFor && t.source)
.map((tool) => ({
params: { slug: tool.slug },
props: { tool },
}));
}) satisfies GetStaticPaths;
const { tool } = Astro.props;
const url = `https://example.com/tools/${tool.slug}`;
---
<html lang="en">
<head>
<title>{tool.name}: pricing and who it fits</title>
<link rel="canonical" href={url} />
</head>
<body>
<h1>{tool.name}</h1>
<p>{tool.summary}</p>
<p>Pricing: {tool.pricing}. Best for: {tool.bestFor}.</p>
<p><a href={tool.source}>Source</a></p>
</body>
</html>The filter does real work. Incomplete rows never become pages, so you can't publish half-empty templates by accident.
If the data lives in Supabase, fetch it at build time instead of importing JSON. The API returns a limited number of rows per request, so read in pages with .range():
import { createClient } from '@supabase/supabase-js';
const supabase = createClient(
import.meta.env.SUPABASE_URL,
import.meta.env.SUPABASE_ANON_KEY
);
async function allTools() {
const rows = [];
for (let from = 0; ; from += 1000) {
const { data, error } = await supabase
.from('tools')
.select('*')
.range(from, from + 999);
if (error) throw error;
rows.push(...data);
if (data.length < 1000) break;
}
return rows;
}Call allTools() inside getStaticPaths() and the rest is the same.
The architecture
Data source Build Output & hosting
------------- ------------------- ----------------------
JSON / CSV ---> /tools/a/index.html
Supabase DB ---> Astro: getStaticPaths() ---> /tools/b/index.html
Markdown ---> + template + filters /sitemap-index.xml
|
Cloudflare Pages
|
Googlebot / Bingbot / visitors
|
PostHog eventsAstro vs Next.js: the comparison
These are design tendencies, not benchmarks. Measure your own site before you decide.
| Astro | Next.js | |
|---|---|---|
| Performance | Little JavaScript by default | Good, but React ships for interactive parts |
| SEO output | Static HTML by default | Static or server HTML, both supported |
| Scalability | Fully static build, or on-demand rendering with an adapter | Static, on-demand and incremental regeneration |
| Hosting cost | Static files can sit on cheap or free static hosts | Static export is cheap. Server features need a Node or edge host |
| Build time | Grows with page count | Grows with page count, but incremental regeneration lets you skip pages at deploy |
| Best fit | Content and pSEO sites | Apps with SEO pages |
The build-time row is the one to test early. Rendering 100,000 pages takes a while in any framework.
Recommended pSEO stack
This is the stack I'd start from for a new data-driven site:
- Astro: page generation. See the Astro docs.
- Tailwind CSS: styling without a big component library.
- Supabase: the data store, when data changes often or a team edits it.
- Cloudflare Pages: static hosting. Check the limits page for file counts before you pass tens of thousands of pages.
- PostHog: product analytics, which pairs well with Search Console data.
Add the official sitemap integration. It splits large sitemaps into several files, which helps once you pass the 50,000 URL limit per file. Once pages are live, read how indexing tools work to see what helps URLs get discovered.
Where Astro is the wrong choice
- ✗ App-like sites. If most pages need logins, dashboards or per-user state, Next.js is the more natural home.
- ✗ Team skills. If your team lives in React, one framework for the app and the SEO pages is simpler.
- ✗ Very large, frequently changing catalogs. A full static build means every change rebuilds the site. Next.js regeneration, or Astro on-demand rendering, can avoid that.
- ✗ Smaller ecosystem. Next.js has more tutorials, hosting integrations and hiring pool.
How to avoid thin content and scaled content abuse
This is the real risk, not the framework. Google's spam policies describe scaled content abuse as creating many pages mainly to manipulate rankings and not to help users. They say this applies however the content is made.
My rules, in order:
- One real search need per page. No page for a query nobody types.
- Unique facts on every page. If two pages differ only by a name, merge them.
- Block incomplete rows. Use a filter like the one in the code above.
- Cite your data. Link the source on the page.
- Launch in small batches. Publish 50, check Search Console, then scale.
- Link every page from a hub. Orphan pages are harder to discover.
- Use noindex for weak pages, and keep them out of the sitemap.
Next: check the basics with the technical SEO checklist or return to the SEO hub.
Do this now
- Write your page template on paper List the 5 facts every page of your pSEO set will show. If a page can't show 5 real facts, it isn't ready to publish. (20 min)
- Put 20 real rows in a JSON file Hand-check each row for a unique name, a source and at least one fact the other rows don't have. (30 min)
- Generate your first 20 pages Use getStaticPaths() with the JSON file. Build once and open 5 pages at random. (45 min)
- Run the build output through a quick check Open the built HTML of one page. Confirm the title, canonical, and main text are in the HTML without running JavaScript. (15 min)
- Write your publish rule Finish this line in your README: "A page goes in the sitemap only when...". Add a filter in getStaticPaths() that enforces it. (10 min)
Frequently asked questions
Is Astro better than Next.js for SEO?
Neither framework ranks pages for you. Both can output crawlable HTML. Astro makes it the default and sends little JavaScript, which suits content sites. Next.js is a better fit when pages also need heavy app logic. Content quality matters far more than the framework.
Can Astro generate thousands of pages?
Yes. A dynamic route with getStaticPaths() returns one entry per page, so thousands of rows from JSON, CSV or a database become thousands of HTML files at build time. Build time and host file limits are the practical ceilings, so check both before going past tens of thousands.
Does Google penalise programmatic SEO pages?
Not for being programmatic. Google's spam policies target scaled content created mainly to manipulate rankings, however it is produced. Pages that help people and carry unique data are fine.
Do I need Supabase for programmatic SEO?
No. A JSON or CSV file works well for a few thousand rows. Supabase helps once the data changes often, needs editing by a team, or is too large to keep in the repo.
When should I choose Next.js instead?
Choose Next.js when the site is mostly an app (logins, dashboards, per-user pages) with SEO pages on top, or when your team already ships React and wants one codebase for both.
Sources
- Astro Docs - Islands architecture
- Astro Docs - Why Astro
- Astro Docs - Routing: getStaticPaths()
- Astro Docs - Sitemap integration
- Next.js Docs - generateStaticParams
- Next.js Docs - Incremental Static Regeneration
- Google Search Central - Spam policies (scaled content abuse)
- Cloudflare Pages - Limits
- Supabase Docs - Select with range
- PostHog Docs - Astro