# @fengsi/nuxt-robots

> a nuxt modules

Latest version **1.0.2** (published 2022-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fengsi/nuxt-robots
pnpm add @fengsi/nuxt-robots
yarn add @fengsi/nuxt-robots
bun add @fengsi/nuxt-robots
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-03-17 |
| First published | 2020-12-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | pony |
| Maintainers | everyx, wusongliang |

## Links

- npm: https://www.npmjs.com/package/@fengsi/nuxt-robots
- Repository: https://github.com/fengsi-io/nuxt-robots
- Homepage: https://github.com/fengsi-io/nuxt-robots#readme
- Issues: https://github.com/fengsi-io/nuxt-robots/issues
- npm.io page: https://npm.io/package/@fengsi/nuxt-robots

## Dependencies (1)

- [async-cache](https://npm.io/package/async-cache.md) ^1.1.0

## Recent versions

- 1.0.2 (latest) — 2022-03-17
- 1.0.1 — 2020-12-11
- 1.0.0 — 2020-12-09

## README

# @fengsi/nuxt-robots

## Setup

1. Add `@fengsi/nuxt-robots` dependency to your project

```bash
yarn add @fengsi/nuxt-robots # or npm install @fengsi/nuxt-robots
```

2. Add `@fengsi/nuxt-robots` to the `modules` section of `nuxt.config.js`

```js
export default {
  modules: [
    // Simple usage
    '@fengsi/nuxt-robots',

    // With options
    ['@fengsi/nuxt-robots', { 
      /* module options */
      cacheTime: 1000 * 60 * 10,
      robots: () => {
        return []
      }
    }]
  ]
}
```

### Using top level options

```js
export default {
  modules: [
    '@fengsi/nuxt-robots'
  ],
  robots: {
    /* module options */
    cacheTime: 1000 * 60 * 10,
    robots: () => {
      return []
    }
  }
}
```
### cache time

default 1000 * 60 * 10 s

## Options

The module option parameter can be:

### `Object`

```js
export default {
  robots: {
    cacheTime: 1000 * 60 * 10,
    robots: {
      UserAgent: '*',
      Disallow: '/'
    }
  }
}
```

### `Array`

```js
export default {
  robots: {
    cacheTime: 1000 * 60 * 10,
    robots: [
      {
        UserAgent: 'Googlebot',
        Disallow: () => '/users' // accepts function
      }
    ]
  }
}
```

### `Function`

```js
export default {
  robots: {
    cacheTime: 1000 * 60 * 10,
    robots: () => {
      return {
        UserAgent: '*',
        Disallow: '/'
      }
    }
  }
}
```

### `null`

status code: 404

```js
export default {
  robots: {
    cacheTime: 1000 * 60 * 10,
    robots: null
  }
}
```

### Will generate a /robots.txt

```bash
User-agent: Googlebot
Disallow: /users
User-agent: Bingbot
Disallow: /admin
```

### The keys and values available:

- UserAgent = `User-agent`
- CrawlDelay = `Crawl-delay`
- Disallow = `Disallow`
- Allow = `Allow`
- Host = `Host`
- Sitemap = `Sitemap`
- CleanParam = `Clean-param`

**Note:** Don't worry keys are parsed with case insensitive and special characters.

The original link [@nuxtjs/robots](https://github.com/wusongliang/robots-module)

---
_Source: https://npm.io/package/@fengsi/nuxt-robots · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
