Nuxt Hooks

Learn how to use Nuxt hooks to modify the robots config.

'robots:config'

Type: (config: ResolvedModuleOptions) => void | Promise<void>

This hook allows you to modify the robots config before it is used to generate the robots.txt and meta tags.

export default defineNuxtConfig({
  hooks: {
    'robots:config': (config) => {
      // modify the config
      config.sitemap = '/sitemap.xml'
    },
  },
})
Did this page help you?