NNext.js Feature Showcase
Routing · Dynamic route

Dynamic Routes

The address itself decides what the page shows. Any segment in /docs/… is captured by the [slug] folder and passed to the page as a parameter: the pattern behind docs, blog posts, profiles and product pages.

Expected behaviour

Go to an address like /docs/anything and the part after /docs/ becomes the slug. This page just shows it; a real app would use it to load the right content from a database, CMS or files.

How this page works

  1. 1The folder name [slug] tells Next.js it's a dynamic route.
  2. 2That part of the address is captured as params.slug.
  3. 3The page receives params from Next.js automatically.
  4. 4The slug is shown on the page.

Live result

You opened

/docs/getting-started

Try another: