Install Nuxt Site Config
Get started with Nuxt Site Config by installing the dependency to your project.
Module Setup
Nuxt Site Config is a already installed when using any of the other Nuxt SEO modules. It's not recommended to use this module directly in your Nuxt app.
bash
npx nuxi module add site-config
bash
npm i nuxt-site-config
You will need to manually add the module to your Nuxt config.
nuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-site-config',
],
})
bash
yarn add nuxt-site-config
You will need to manually add the module to your Nuxt config.
nuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-site-config',
],
})
bash
pnpm i nuxt-site-config
You will need to manually add the module to your Nuxt config.
nuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-site-config',
],
})
bash
bun i nuxt-site-config
You will need to manually add the module to your Nuxt config.
nuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-site-config',
],
})
Install Module
Use the install function in your module:
modules.ts
import { installNuxtSiteConfig, updateSiteConfig } from 'nuxt-site-config/kit'
export default defineNuxtModule({
// ...
async setup(options) {
await installNuxtSiteConfig()
// Optional: set some site config from your modules options
// This is not recommended, only to keep supporting your modules options
updateSiteConfig({
_context: 'my-module',
url: options.siteUrl,
})
}
})
That's it! Explore the documentation to learn more.
Did this page help you?