# nuxtjs-named-routes

> A Nuxt.js module that sets router named routes from nuxt.config file

Latest version **1.0.5** (published 2022-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install nuxtjs-named-routes
pnpm add nuxtjs-named-routes
yarn add nuxtjs-named-routes
bun add nuxtjs-named-routes
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2022-10-29 |
| First published | 2022-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tibor Pino |
| Maintainers | tibor.pino |

## Links

- npm: https://www.npmjs.com/package/nuxtjs-named-routes
- Repository: https://github.com/tiborpino/nuxtjs-named-routes
- Homepage: https://github.com/tiborpino/nuxtjs-named-routes#readme
- Issues: https://github.com/tiborpino/nuxtjs-named-routes/issues
- npm.io page: https://npm.io/package/nuxtjs-named-routes

## Dependencies (1)

- [@nuxt/kit](https://npm.io/package/@nuxt/kit.md) ^3.0.0-rc.12

## Recent versions

- 1.0.5 (latest) — 2022-10-29
- 1.0.4 — 2022-10-29
- 1.0.3 — 2022-10-29
- 1.0.2 — 2022-10-27
- 1.0.1 — 2022-10-27

## README

# nuxtjs-named-routes

> A Nuxt.js module that sets router named routes from nuxt.config file
## Features

- Nuxt 3 support
- Sets router named routes from nuxt.config file
## Setup

1. Add `nuxtjs-named-routes` dependency to your project
```bash
yarn add nuxtjs-named-routes # or npm install nuxtjs-named-routes
```

2. Add `nuxtjs-named-routes` to the `modules` section of `nuxt.config.ts`

```js
export default defineNuxtConfig({
  modules: [
    'nuxtjs-named-routes'
  ],
  namedRoutes: {
    routes: {
        'custom-key': {
            path: '/custom-url-for-homepage',
            file: '/pages/homepage.vue'
        }
    }
  }
}
```

3. Use the named route
```js
<NuxtLink :to="{name: 'custom-key'}">Link to the homepage</NuxtLink>
```

The code above will generate HTML link

```html
<a href="/custom-url-for-homepage">Link to the homepage</a>
```

## Options

### routes

- Type: `Object`
- Default: `{}`

```js
routes: {
  'named-route-key': {
    path: '/url-path',
    file: '/pages/homepage.vue'
}
}
```

## License

[MIT License](./LICENSE)

Copyright (c) - Tibor Piňo

---
_Source: https://npm.io/package/nuxtjs-named-routes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
