useSiteConfig()
Access the current site config within a Nuxt context.
Usage
component.vue
<script setup lang="ts">
const siteConfig = useSiteConfig()
</script>
<template>
<div>
<h1>{{ siteConfig.name }}</h1>
</div>
</template>API
debug
- Type:
boolean - Default:
false
Provides a _context object to track the source of what sets the site config.
nuxt.config.ts
export default defineNuxtConfig({
site: {
name: 'My Site',
},
})const siteConfig = useSiteConfig({ debug: true })
console.log(siteConfig.name, siteConfig._context.name)
// My Site, 'nuxt-site-config:config'resolveRefs
- Type:
boolean - Default:
true
Whether to resolve any ref values within the site config before returning.
skipNormalize
- Type:
boolean - Default:
false
Skips normalizing the site config and returns it in the raw format the provider set.
Was this page helpful?