Custom routes are routes that are not defined in Drupal. They are defined in the frontend and can be used to render custom pages.
In the frontend, the Drupal routing is managed by the wildcard
pages/[...slug].vue file within the pages directory.
In order to create a custom route in the frontend:
- Go to the
- Create a new file with the desired route name. For instance, if you want a route named
search, create a file called
In your Nuxt.js application, the routing mechanism runs in the following order:
- Nuxt.js Routing: It attempts to align the navigated path with one of the predefined routes located in your
- Dynamic Route Fallback: If no predefined routes match, the system defaults to a wildcard route. This is represented by the
[...slug].vuedynamic route, which serves as the fallback.
In the event that no matching route is found, by default, error pages provided by Drupal (e.g. 403, 404 page) are shown, while keeping the right status code.
For more information on routing in Nuxt.js, see the Nuxt routing documentation.