---
title: "Config using Nuxt Config"
description: "Learn how to configure the module programmatically using nuxt.config."
canonical_url: "https://nuxtseo.com/docs/robots/guides/nuxt-config"
last_updated: "2026-05-25T04:22:47.355Z"
---

If you need programmatic control, you can configure the module using nuxt.config.

## Simple Configuration

The simplest configuration is to provide an array of paths to disallow for the `*` user-agent. If needed you can
provide `allow` paths as well.

- `disallow` - An array of paths to disallow for the `*` user-agent.
- `allow` - An array of paths to allow for the `*` user-agent.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  robots: {
    // provide simple disallow rules for all robots `user-agent: *`
    disallow: ['/secret', '/admin'],
    allow: '/admin/login'
  }
})
```

This will generate the following output:

```robots-txt [robots.txt]
User-agent: *
Disallow: /secret
Disallow: /admin
Allow: /admin/login
```

## Group Configuration

When targeting specific robots, you can use the `groups` option to provide granular control.

- `groups` - A stack of objects to provide granular control (see below).

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  // add more granular rules
  robots: {
    groups: [
      // block specific robots from specific pages
      {
        userAgent: ['AdsBot-Google-Mobile', 'AdsBot-Google-Mobile-Apps'],
        disallow: ['/admin'],
        allow: ['/admin/login'],
        comment: 'Allow Google AdsBot to index the login page but no-admin pages'
      },
    ]
  }
})
```

This will generate the following output:

```robots-txt [robots.txt]
# Allow Google AdsBot to index the login page but no-admin pages
User-agent: AdsBot-Google-Mobile
User-agent: AdsBot-Google-Mobile-Apps
Disallow: /admin
Allow: /admin/login
```

## AI Directives Configuration

Configure AI usage preferences using `contentUsage` and `contentSignal`:

<code-group>

```ts [Object Format (Recommended)]
export default defineNuxtConfig({
  robots: {
    groups: [
      {
        userAgent: '*',
        allow: '/',
        contentUsage: {
          'bots': 'y',
          'train-ai': 'n'
        },
        contentSignal: {
          'ai-train': 'no',
          'search': 'yes'
        }
      }
    ]
  }
})
```

```ts [String Format]
export default defineNuxtConfig({
  robots: {
    groups: [
      {
        userAgent: '*',
        allow: '/',
        contentUsage: ['bots=y, train-ai=n'],
        contentSignal: ['ai-train=no, search=yes']
      }
    ]
  }
})
```

</code-group>

- **contentUsage** - IETF standard: `bots`, `train-ai`, `ai-output`, `search` with `y`/`n`
- **contentSignal** - Cloudflare: `search`, `ai-input`, `ai-train` with `yes`/`no`

<alert type="info">

**Object format** provides type safety and autocomplete. **String format** supports path-specific rules. See the [**AI Directives Guide**](/docs/robots/guides/ai-directives) for complete documentation.

</alert>
