Skip to main content

Pages

Nuxt Kit provides a set of utilities to help you create and use pages. You can use these utilities to manipulate the pages configuration or to define route rules.

extendPages

In Nuxt, routes are automatically generated based on the structure of files in the app/pages directory. However, you can customize these routes using the extendPages feature.

Type

Parameters

callback: A function that will be called with the pages configuration. You can alter this array by adding, deleting, or modifying its elements. Note: You should modify the provided pages array directly, as changes made to a copied array will not be reflected in the configuration. Each page object has the following properties:

Usage

extendRouteRules

Nuxt is powered by the Nitro server engine. With Nitro, you can incorporate high-level logic directly into your configuration for actions like redirects, proxying, caching, and appending headers.

Type

Parameters

route: A route pattern to match against. rule: A route rule configuration to apply to the matched route. See Nitro route rules for available options. options: Options object:

Usage

addRouteMiddleware

Registers route middlewares to be available for all routes or for specific routes. Route middlewares can also be defined in plugins via the addRouteMiddleware composable.

Type

Parameters

input: A middleware object or an array of middleware objects: options: Options object:

Usage

Source

View source on GitHub