Nuxt Site Config Kit is a utility package for Nuxt 3 modules, providing a centralized and consistent way to manage site-wide configuration. It offers both build-time utilities and runtime composables, enabling module authors and application developers to define, extend, and consume common site metadata such as name, URL, and language. The current stable version is 4.0.8, with frequent patch releases addressing bug fixes, and major versions introducing breaking changes as demonstrated with v4.0.0. Its key differentiator is establishing a standardized API for site configuration across the Nuxt ecosystem, which allows various modules (e.g., SEO, sitemaps, PWA) to leverage a unified, extensible data source, thereby reducing configuration duplication and enhancing developer consistency.
npm install nuxt-site-config-kitVerified import paths — ran on the pinned version, not inferred.
Demonstrates setting basic site configuration in `nuxt.config.ts` and then consuming it within a Vue component using the `useSiteConfig` composable.
Explicitly set `site.name` in `nuxt.config.ts` under the `site` property:
```ts
export default defineNuxtConfig({
site: {
name: 'My Website',
}
})
```
Alternatively, use the `NUXT_SITE_NAME` environment variable.Always use environment variables for sensitive or environment-dependent values like `url`. For example, `url: process.env.NUXT_PUBLIC_SITE_URL ?? 'https://localhost:3000'`.
Wrap `useSiteConfig()` within a component's `setup()` function or directly in `<script setup>` to ensure it's executed in the correct Nuxt context.
Add a `site.name` property to your `nuxt.config.ts` file or set the `NUXT_SITE_NAME` environment variable.
Ensure `useSiteConfig()` is called within a `<script setup>` block of a Vue component, inside a component's `setup()` method, or within a Nuxt plugin or hook that provides the necessary context.
Verify that `'nuxt-site-config-kit'` is included in the `modules` array of your `nuxt.config.ts` and that the `site` object within `defineNuxtConfig` is correctly defined and populated.