Upgrading @nuxtjs/robots 6 to 7
Breaking6.2.4 → 7.0.2Breaking13Platform1New6Changed2Fixed19
13 breaking changes and a platform requirement change.
- This version only works with newer Nuxt releases; projects on Nuxt 3 must upgrade Nuxt first.
- On Nuxt 4, move robots.txt files from assets/ and pages/ into app/assets/ or app/pages/.
- Nuxt Content v2 is no longer supported; you need Nuxt Content v3.
- Site Config is upgraded to v5, which changes how build time configuration is prioritized.
@nuxtjs/robots publishes an official migration guide for version 7. It covers more than the release notes do.
V5 to v6 migration guide ↗Requires Node.js ^22.22.3 || ^24.15.0 || >=26.0.0 from 7.0.0 (none stated before).
Adds @vueuse/core ^15.0.0.
Drops h3, pathe, pkg-types.
Installs 35 packages in all (was 53).
Also installs @types/web-bluetooth, @vueuse/metadata, @vueuse/shared.
No longer installs @clack/core, @clack/prompts, @nuxt/devtools-kit, @polka/url, birpc, citty, confbox, cookie-es, crossws, fast-string-truncated-width, fast-string-width, fast-wrap-ansi, iron-webcrypto, mrmime, node-mock-http and 5 more.
Moves nuxt-site-config 4.2.3 → 5.0.3, nuxt-site-config-kit 4.2.3 → 5.0.3, nuxtseo-shared 5.3.16 → 6.0.3, site-config-stack 4.2.3 → 5.0.3. Your build may pick other versions.
What you must change
srcDirdefineRobotsSchema()#robots/server#robots/app#internal/nuxt-robots#internal/nuxt-simple-robotsgetBotDetection()RequestEventgetSiteRobotConfig()getPathRobotConfig()getBotDetection()isBot()getBotInfo()robots:configrobots:robots-txtrobots:configsite-config:initgetNitroOrigin()useRobotsRule()robotsDisabledValuerobotsEnabledValuedefinePageMeta()defineRobotsSchema()zodnuxtseo-devtools-hostAPI changes
Generated by DepDelta from published .d.ts files. Not mixed with prose notes.
- changed:
const defineRobotsSchema: (options?: nuxtseo_shared_content.ContentSchemaOptions | undefined) => z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>> → const defineRobotsSchema: (options?: nuxtseo_shared_content.ContentSchemaOptions | undefined) => z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>> - changed:
const schema: z.ZodObject<{ [x: string]: any }, z.core.$strip, z.ZodTypeAny, { [x: string]: any }, { [x: string]: any }> → const schema: z.ZodObject<{ [x: string]: any }, z.core.$strip>
- changed:
property ModuleOptions.blockAiBots: boolean → property ModuleOptions.blockAiBots: boolean | 'training'
- added:
export { useBotDetection } from '../../composables/mock'
- added:
export { ReactiveRobotsValue } from '../../composables/useRobotsRule' - added:
export { useRobotsRule } from '../../composables/useRobotsRule'
- added:
export { BotInfo } from '../../types' - added:
export { ReactiveRobotsValue } from '../composables/useRobotsRule' - added:
export { RobotsValue } from '../../types' - added:
export { UseBotDetectionOptions } from '../../types' - added:
export { UseBotDetectionReturn } from '../../types' - added:
export { useBotDetection } from '../composables/mock' - added:
export { useRobotsRule } from '../composables/useRobotsRule'
- changed:
function useRobotsRule(rule?: MaybeRef<boolean | string>): import('vue').Ref<string, string> → function useRobotsRule(rule?: ReactiveRobotsValue): import('vue').Ref<string, string>
- added:
export { useBotDetection } from '../../composables/mock'
- added:
export { ReactiveRobotsValue } from '../../composables/useRobotsRule' - added:
export { useRobotsRule } from '../../composables/mock'
- added:
export { BotInfo } from '../../types' - added:
export { ReactiveRobotsValue } from '../composables/useRobotsRule' - added:
export { RobotsValue } from '../../types' - added:
export { UseBotDetectionOptions } from '../../types' - added:
export { UseBotDetectionReturn } from '../../types' - added:
export { useBotDetection } from '../composables/mock' - added:
export { useRobotsRule } from '../composables/mock'
- added:
export { BotInfo } from '../types' - added:
export { ReactiveRobotsValue } from './composables/useRobotsRule' - added:
export { RobotsValue } from '../types' - added:
export { UseBotDetectionOptions } from '../types' - added:
export { UseBotDetectionReturn } from '../types' - added:
export { useBotDetection } from './composables/useBotDetection' - added:
export { useRobotsRule } from './composables/useRobotsRule'
- added:
export { getBotDetection } from '../../mock-composables' - added:
export { getBotInfo } from '../../mock-composables' - added:
export { isBot } from '../../mock-composables'
- added:
export { getPathRobotConfig } from '../../composables/getPathRobotConfig'
- added:
export { getSiteRobotConfig } from '../../composables/getSiteRobotConfig'
- added:
export { BotDetectionContext } from '../../types' - added:
export { BotInfo } from '../../types' - added:
export { RobotsContext } from '../../types' - added:
export { getBotDetection } from '../mock-composables' - added:
export { getBotInfo } from '../mock-composables' - added:
export { getPathRobotConfig } from '../composables/getPathRobotConfig' - added:
export { getSiteRobotConfig } from '../composables/getSiteRobotConfig' - added:
export { isBot } from '../mock-composables'
- changed:
function getBotDetection(event: H3Event): any → function getBotDetection(event: RequestEvent): any - changed:
function getBotInfo(event: H3Event): any → function getBotInfo(event: RequestEvent): any - changed:
function isBot(event: H3Event): boolean → function isBot(event: RequestEvent): boolean
- changed:
function getPathRobotConfig(e: H3Event, options?: { userAgent?: string; skipSiteIndexable?: boolean; path?: string }): RobotsContext → function getPathRobotConfig(e: RequestEvent, options?: { userAgent?: string; skipSiteIndexable?: boolean; path?: string }): RobotsContext
- changed:
function getSiteRobotConfig(e: H3Event): { indexable: boolean; hints: string[] } → function getSiteRobotConfig(e: RequestEvent): { indexable: boolean; hints: string[] }
- changed:
function useRuntimeConfigNuxtRobots(event?: H3Event): NuxtRobotsRuntimeConfig → function useRuntimeConfigNuxtRobots(_event?: Pick<RequestEvent, 'context'>): NuxtRobotsRuntimeConfig
- added:
export { getBotDetection } from '../../mock-composables' - added:
export { getBotInfo } from '../../mock-composables' - added:
export { isBot } from '../../mock-composables'
- added:
export { getPathRobotConfig } from '../../mock-composables'
- added:
export { getSiteRobotConfig } from '../../mock-composables'
- added:
export { BotDetectionContext } from '../../types' - added:
export { BotInfo } from '../../types' - added:
export { RobotsContext } from '../../types' - added:
export { getBotDetection } from '../mock-composables' - added:
export { getBotInfo } from '../mock-composables' - added:
export { getPathRobotConfig } from '../mock-composables' - added:
export { getSiteRobotConfig } from '../mock-composables' - added:
export { isBot } from '../mock-composables'
- added:
export { BotDetectionContext } from '../types' - added:
export { BotInfo } from '../types' - added:
export { RobotsContext } from '../types' - added:
export { getBotDetection } from './composables/getBotDetection' - added:
export { getBotInfo } from './composables/getBotDetection' - added:
export { getPathRobotConfig } from './composables/getPathRobotConfig' - added:
export { getSiteRobotConfig } from './composables/getSiteRobotConfig' - added:
export { isBot } from './composables/getBotDetection'
- changed:
const _default: any → const _default: import('nuxt/server').EventHandler<Promise<void>>
- changed:
function getBotDetection(e: H3Event): BotDetectionContext → function getBotDetection(e: RequestEvent): BotDetectionContext - changed:
function getBotInfo(e: H3Event): null → function getBotInfo(e: RequestEvent): null - changed:
function getPathRobotConfig(e: H3Event, options?: { skipSiteIndexable?: boolean; path?: string }): { indexable: boolean; rule: string } → function getPathRobotConfig(e: RequestEvent, options?: { userAgent?: string; skipSiteIndexable?: boolean; path?: string }): { indexable: boolean; rule: string } - changed:
function getSiteRobotConfig(e: H3Event): { indexable: boolean; hints: string[] } → function getSiteRobotConfig(e: RequestEvent): { indexable: boolean; hints: string[] } - changed:
function isBot(e: H3Event): boolean → function isBot(e: RequestEvent): boolean
- changed:
const _default: any → const _default: import('nuxt/server').EventHandler<Promise<{ robotsTxt: string; indexable: boolean; hints: string[]; runtimeConfig: import('../../../types.js').NuxtRobotsRunti…
- changed:
const _default: any → const _default: import('nuxt/server').EventHandler<Promise<{ rule: string; indexable: boolean; crawlable: boolean; path: string; debug: { source: string | null; line: string |…
- changed:
const _default: any → const _default: import('nuxt/server').EventHandler<Promise<ProductionDebugResponse>>
- removed:
const _default: any - removed:
default _default
- changed:
const _default: any → const _default: import('nuxt/server').EventHandler<Promise<string>>
- changed:
function resolveRobotsTxtContext(e: H3Event | undefined, nitro?: NitroApp): Promise<HookRobotsConfigContext<H3Event>> → function resolveRobotsTxtContext(e: RequestEvent | undefined, nitro?: NitroApp): Promise<HookRobotsConfigContext<RequestEvent>>
- added:
function withoutLocalePrefix(path: string, publicRuntimeConfig: Record<string, unknown>): string
- removed:
property NuxtRobotsRuntimeConfig.isNuxtContentV2: boolean - removed:
property NuxtRobotsRuntimeConfig.pageMetaRobots: Record<string, RobotsValue> - changed:
interface HookRobotsConfigContext<Event = H3Event> extends ParsedRobotsTxt → interface HookRobotsConfigContext<Event = RequestEvent> extends ParsedRobotsTxt - changed:
interface HookRobotsTxtContext<Event = H3Event> → interface HookRobotsTxtContext<Event = RequestEvent>
- changed:
function getBotDetection(headers: Record<string, string | string[] | undefined>, patternMap?: Map<string, PatternMapValue>): BotDetectionContext → function getBotDetection(headers: Headers | Record<string, string | string[] | undefined>, patternMap?: Map<string, PatternMapValue>): BotDetectionContext - changed:
function isBotFromHeaders(headers: Record<string, string | string[] | undefined>, patternMap?: Map<string, PatternMapValue>): { isBot: boolean; data?: { botName: BotName; botCategory: BotCategory; trusted: boolean } } → function isBotFromHeaders(headers: Headers | Record<string, string | string[] | undefined>, patternMap?: Map<string, PatternMapValue>): { isBot: boolean; data?: { botName: BotName; botCategory: BotCategory; trusted: boolean } }