useSiteConfig()
How to access site config within a Nuxt context.
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
Will provide a
export default defineNuxtConfig({
site: {
name: 'My Site',
},
})
const siteConfig = useSiteConfig({ debug: true })
console.log(siteConfig.name, siteConfig._context.name)
// My Site, 'nuxt.config.ts'
resolveRefs
- Type:
boolean - Default:
false
Should any ref values within the site config be resolved when returned.
skipNormalize
- Type:
boolean - Default:
false
Skips the normalizing of the site config, will return it in a raw format in how it was provided.
Did this page help you?