Template Pages supports conventional page-based routes where the name of each page can be requested with or without its .html extension:

path page
/db
/db.html /db.html
/posts/new
/posts/new.html /posts/new.html

and the default route / maps to the index.html in each directory if it exists, e.g:

path page
/ /index.html

Nuxt-like Dynamic Routes can also be used where any file or directory names prefixed with an _ underscore allows for dynamic wildcard paths with the matching path component also assigned to the arguments name:

path page arguments
/ServiceStack /_user/index.html user=ServiceStack
/posts/markdown-example /posts/_slug/index.html slug=markdown-example
/posts/markdown-example/edit /posts/_slug/edit.html slug=markdown-example

As the _ underscore prefix for declaring wildcard pages is also what is used to declare "hidden" pages, to disambiguate them from hidden partials and layouts, the recommendation is to have them include layout and partial their name, i.e:

  • _layout.html
  • _alt-layout.html
  • _menu-partial.html

Pages with layout or partial in their name are hidden and ignored in wildcard path resolution.

If you follow the recommended _{name}-partial.html naming convention you will also be able to reference partials using just their name, i.e:

{{ 'menu' | partial }}          // Equivalent to:
{{ '_menu-partial' | partial }}