Does generateStaticParams hide a missing blog slug?
No. It chooses paths to pre-render, but unknown dynamic routes still need explicit lookup and notFound handling. Otherwise a generic 200 page can become a soft 404.
Written for next.js developers building static or hybrid article routes from files, a CMS, or generated content records.
Key facts
- generateStaticParams supplies dynamic route parameters for static generation.
- Its output does not replace a page-level content existence check.
- notFound() terminates rendering for the route and returns Next.js not-found handling.
A useful rule: make each important claim understandable and verifiable without requiring the reader to reconstruct your meaning from the rest of the page.
What does generateStaticParams actually do?
The function returns parameter objects for dynamic routes that Next.js should generate during the build or supported regeneration flow. For `/blog/[slug]`, each object normally contains one known slug from the same content inventory used by the page. This improves static output and discovery, but it is not an allow list unless the rest of the route configuration and runtime logic enforce that behaviour. The page still receives parameters and must verify that a matching public article exists before rendering metadata or content.
- Generate params from the canonical public inventory.
- Exclude drafts and invalid records.
- Keep the page lookup as the authority for existence.
How can an unknown slug return 200?
A page component may use a fallback object, show “article not found” inside the normal layout, or catch lookup errors and return generic content. The server then sends 200 because no not-found boundary was invoked. Metadata may also inherit the blog title and canonicalize the missing URL to itself. Search systems see a thin or error-like page with a success status and can classify it as a soft 404. Replace visible-only error states with `notFound()` when the public record does not exist.
- Do not render missing messages inside a successful detail template.
- Call notFound before generating page-specific output.
- Avoid self-canonical metadata for nonexistent records.
Should generateMetadata repeat the lookup?
Both metadata and page rendering need the article record. Use a shared cached lookup where appropriate so they agree without duplicating remote work. If the record is missing, `generateMetadata` can call `notFound()` or the page can establish the result according to framework behaviour, but the final response must be a real 404 with no misleading article schema. Never return homepage metadata as a fallback for an unknown slug. Test the installed Next.js version because parameter and error-handling APIs evolve.
- Share one typed article lookup.
- Return consistent missing behaviour from metadata and page.
- Remove Article JSON-LD from 404 responses.
What about new CMS articles after the build?
Choose the route's dynamic and revalidation strategy deliberately. A fully static export needs a new build to include new slugs. A server deployment can render additional paths at request time if configured, while cached routes may use revalidation. Whatever model you choose, the sitemap and internal links should publish a URL only when the route can serve the complete article. Do not add a CMS record to discovery surfaces before the application version or cache can resolve it.
- Document when new slugs become routable.
- Publish sitemap entries atomically with route availability.
- Test draft and scheduled-state filtering.
Sources: 1
Which tests cover the route lifecycle?
Assert that every published content record appears in generated params or is supported by the chosen dynamic strategy. Request a known slug, an unknown slug, a draft slug, and a malformed encoded slug from the built application. Require 200 only for public content, 404 for missing content, one canonical for valid pages, and no Article entity on errors. Also verify that internal links and sitemap URLs resolve to 200. This catches gaps between content inventory, build output, runtime lookup, and discovery. Repeat it whenever publishing infrastructure changes.
- Test known, unknown, draft, and malformed slugs.
- Cross-check sitemap URLs against route responses.
- Assert status, canonical, robots, and schema together.
Put it to work
Find the highest-impact fix on your site.
Compare known and missing slugs for status codes, canonical tags, robots directives, and structured data.
Test dynamic route statusSources
- 1.Next.js documentation: generateStaticParamsChecked 2026-07-26
- 2.Next.js documentation: App Router error handlingChecked 2026-07-26