v7.0.0

Introduction

Nuxt Robots v7 moves the module to the portable server APIs of Nuxt 4.6 and Nuxt 5. It ships in Nuxt SEO v6. If you use @nuxtjs/seo, follow the Nuxt SEO v5 to v6 migration guide.

It also adds an AI training opt out and matches page metadata with your app router.

Check the breaking changes first. The upgrade steps list what to change.

Breaking Changes

Nuxt 4.6 and Node 22

Nuxt Robots v7 requires Nuxt ^4.6.0 || ^5.0.0. Nuxt 3 support is removed. (#333)

It also requires Node ^22.22.3 || ^24.15.0 || >=26.0.0.

Site Config v5

Nuxt Robots loads Nuxt Site Config >=5.0.0 as a module dependency. (#345)

Site Config v5 changes the priority of build time config. Check the Site Config v5 release notes.

Nuxt Content v2 Removed

The Nuxt Content integration now needs Nuxt Content v3. (#350)

If your project has Nuxt Content v2, Nuxt stops at startup with a version error. Upgrade to Nuxt Content v3 and add defineRobotsSchema() to your collection.

Public Server and App Imports

Import server functions from #robots/server. Import app composables from #robots/app. (#333)

The #internal/nuxt-robots and #internal/nuxt-simple-robots aliases are removed.

- import { getBotDetection } from '#robots/server/composables/getBotDetection'
- import { defineEventHandler } from 'h3'
+ import { getBotDetection } from '#robots/server'
+ import { defineEventHandler } from 'nuxt/server'

Auto imports still work. If you disable the module, both aliases export typed mocks. If you disable bot detection, only the bot detection functions are mocks.

Server Hooks Use RequestEvent

Server functions and Nitro hook contexts use the RequestEvent type from nuxt/server. (#333)

The change covers getSiteRobotConfig(), getPathRobotConfig(), getBotDetection(), isBot(), and getBotInfo(). It also covers the robots:config and robots:robots-txt hooks. Read request data from the web standard Request:

 nitroApp.hooks.hook('robots:config', (ctx) => {
-  const host = ctx.event?.headers.get('host')
+  const host = ctx.event?.req.headers.get('host')
 })

robots:config Edits Stay in Their Request

A robots:config hook that uses ctx.event now changes only the robots.txt response for that request. (#340)

In v6, these edits leaked into the indexing rules of later requests. To disable indexing for a host, use the site-config:init hook:

server/plugins/robots-domain.ts
import { getNitroOrigin } from '#site-config/server'

export default defineNitroPlugin((nitroApp) => {
  nitroApp.hooks.hook('site-config:init', ({ event, siteConfig }) => {
    if (new URL(getNitroOrigin(event)).hostname.startsWith('staging.'))
      siteConfig.push({ indexable: false, _context: 'host-indexing' })
  })
})

See Handling Multiple Domains.

useRobotsRule(true) Respects Site Indexing

useRobotsRule(true) now sends robotsDisabledValue when Site Config disables indexing. (#340)

In v6, it sent robotsEnabledValue, so a staging page could become indexable. null now keeps the existing rule, as undefined already did.

Route Rules Take Precedence Over Page Metadata

When a route rule and definePageMeta({ robots }) both match a path, the route rule now wins. (#340)

Custom robots.txt Paths Use srcDir

The module reads assets/robots.txt, pages/robots.txt, and pages/_dir/robots.txt from srcDir. (#340)

On Nuxt 4, the default srcDir is app/. If you keep that default, move these files to app/assets/ or app/pages/. The public/ and root directory paths do not change.

Zod 4 for defineRobotsSchema()

The optional zod peer dependency is now ^4.6.5. If you use defineRobotsSchema(), install Zod 4.6.5 or a later 4.x release. (#333)

DevTools Needs nuxtseo-devtools-host

The Robots DevTools panel needs the nuxtseo-devtools-host package as a dev dependency. (#333)

pnpm add -D nuxtseo-devtools-host

Restart the dev server after you install it. You do not add it to modules.

Features

Block AI Training Crawlers

Set blockAiBots: 'training' to opt out of AI training. Dedicated AI search and answer agents stay unblocked. (#349)

nuxt.config.ts
export default defineNuxtConfig({
  robots: {
    blockAiBots: 'training',
  },
})

This mode blocks GPTBot, ClaudeBot, Google-Extended, meta-externalagent, Applebot-Extended, and CCBot. Google-Extended also controls Gemini grounding, so this mode opts out of grounding too. blockAiBots: true still blocks every token in the AiBots list.

Page Metadata Matches Your Router

definePageMeta({ robots: false }) now matches paths with the app router. (#340, #341, #342)

Matching respects router.options sensitive, strict, and end, plus aliases and nested routes. The module compiles the rules after page route transforms, such as Nuxt I18n locale routes.

Nuxt Content v3 in Any Module Order

Nuxt Robots and Nuxt Content v3 now work in either module order. (#340)

Call useRobotsRule() with the frontmatter value to send the same rule in the X-Robots-Tag header:

useSeoMeta(page.value?.seo || {})
useRobotsRule(page.value?.robots ?? undefined)

Agent Skill

The package ships an Agent Skill at skills/nuxtjs-robots/SKILL.md. (#339)

Coding agents read it from node_modules/@nuxtjs/robots/skills/.

Bug Fixes

  • An explicit allow route rule now beats a catch-all noindex header. (#337)
  • disableNuxtContentIntegration now turns off the Nuxt Content integration. (#340)
  • A string comment in a groups entry now prints one comment line. (#340)
  • disallowNonIndexableRoutes no longer writes Disallow lines for the build assets directory. (#340)
  • getBotDetection() from @nuxtjs/robots/util now accepts a Headers instance. (#340)
  • useBotDetection() builds without a separate @vueuse/core install. (#333)
  • On Nitro 3, boolean robots route rules keep their meaning. (#333)
  • On Nitro 3, the module sets X-Robots-Tag after the middleware header merge. (#331)
  • App imports work on both Nuxt 4 and Nuxt 5. (#331)

Upgrading

  1. Upgrade to Nuxt 4.6 or Nuxt 5. Use Node 22.22.3+, 24.15.0+, or 26+.
  2. If you use @nuxtjs/seo, follow the Nuxt SEO v5 to v6 migration guide. Otherwise, install @nuxtjs/robots@^7.
  3. Replace #internal/nuxt-robots and deep #robots/... imports with #robots/server or #robots/app.
  4. Replace event.headers and event.node.req in robots hooks with event.req.headers.
  5. Move per host indexing from robots:config to the site-config:init hook.
  6. Move assets/robots.txt and pages/robots.txt into srcDir.
  7. If you use Nuxt Content v2, upgrade to Nuxt Content v3.
  8. To keep the DevTools panel, run pnpm add -D nuxtseo-devtools-host.
Was this page helpful?