Site config is resolved from the following sources, in order of precedence:
System details relate to the environment the app is running in.
export default {
name: rootDirBaseName, // e.g. '/home/harlan/projects/my-nuxt-app' -> 'my-nuxt-app'
indexable: process.env.NODE_ENV === 'production'
}
Site config provided by the package.json file.
export default {
name: pkgJson.name,
description: pkgJson.description,
}
Environment variables provided by the hosting providers.
export default {
url: [
// vercel, netlify
process.env.NUXT_ENV_VERCEL_URL,
process.env.URL,
// cloudflare pages
process.env.CF_PAGES_URL,
],
// vercel, netlify
name: [process.env.NUXT_ENV_VERCEL_GIT_REPO_SLUG, process.env.SITE_NAME]
}
Build time site config provided by modules.
site keySite config provided by the user in the Nuxt config.
Site config provided by the user at runtime. runtimeConfig.public.site and associated environment variables.
This will also attempt to use legacy environment variables from Nuxt:
siteUrl, public.siteUrlPUBLIC: NUXT_ENV_SITE_URL, NUXT_ENV_PUBLIC_SITE_URLThe site-config:resolve hook is called to allow any final build-time modifications to the config.
The request URL is used to determine the site URL at runtime.
Config resolved in the build step. This is stored on the runtimeConfig.public.site key.
Config resolved from the route rules of the request path, the site key. This allows for multi-site support.
Uses the site URL from the window.location.origin.
The SSR runtime config created in the SSR step. This is sent to the client-side to avoid hydration errors.