Api

updateSiteConfig()

Last updated by
Harlan Wilton
in docs: broken links.

Modify the site config at runtime. You can provide any config to this function, such as the recommended config.

When using this, you will to run it as early as possible in the Nuxt lifecycle to avoid conflicts with other modules. It's recommended to use the Nitro updateSiteConfig API instead.

Usage

plugins/site-config.server.ts
import { updateSiteConfig } from '#imports'

export default defineNuxtPlugin({
  enforce: 'pre', // make it happen early
  setup() {
    updateSiteConfig({
      name: 'My Site',
      url: 'https://example.com',
    })
  }
})
Did this page help you?