Filesystem Routing

By default, Vike does Filesystem Routing: the URL of a page is determined based on where its .page.js file is located.

FILESYSTEM                        URL
pages/               /about
# `index` is mapped to the empty string
pages/index/         /
# Case sensitive
pages/               /HELLO
# Parameterized
pages/movie/           /movie/1, /movie/2, /movie/3, ...

Filesystem Routing ignores all the following directories:

  • index/
  • pages/
  • src/

For example:

FILESYSTEM                                         URL
src/pages/jobs/                       /jobs
pages/pages/src/src/index/pages/      /about
contact/                              /contact

This allows us to have a domain-driven file structure such as:

FILESYSTEM                        URL
user/pages/           /user/list
user/pages/         /user/create
todo/pages/           /todo/list
todo/pages/         /todo/create

We can change the URL root of Filesystem Routing by using

For more advanced routing, see Route Strings and Route Functions.