Understanding Site Config · Nuxt SEO

-
-
-
-

[1.4K](https://github.com/harlan-zw/nuxt-seo)

[Nuxt SEO on GitHub](https://github.com/harlan-zw/nuxt-seo)

Nuxt SEO

-
-
-
-
-
-
-
-
-
-

Search…```k`` /`

v5.1.3

- Playgrounds
- [Discord Support](https://discord.com/invite/275MBUBvgP)

### Getting Started

-
-
-
-

### Core Concepts

-
-
-
-
-
-
-
-
-

Core Concepts

# Understanding Site Config

[Copy for LLMs](https://nuxtseo.com/docs/nuxt-seo/guides/site-config.md)

Every SEO module needs your site URL - sitemaps, OG images, Schema.org identifiers. Site Config lets you set it once instead of duplicating config across modules.

## [Quick Setup](#quick-setup)

For most sites, add this to `nuxt.config.ts`:

```
export default defineNuxtConfig({
  site: {
    url: 'https://example.com',
    name: 'My Site'
  }
})
```

That's it. All modules now know your canonical URL and site name.

## [Available Options](#available-options)

| Option | Purpose | Default |
| --- | --- | --- |
| `url` | Canonical site URL (required for SEO) | Auto-detected in dev |
| `name` | Site name for meta tags, Schema.org | - |
| `description` | Default meta description | - |
| `defaultLocale` | Language code (e.g., `en`) | Auto from i18n |
| `indexable` | Allow search engine indexing | `true` in production |
| `trailingSlash` | URLs end with `/` | `false` |

See

 for all options.

## [Environment-Specific Config](#environment-specific-config)

Running staging or preview environments? Use environment variables so each deployment gets the right URL:

```
# .env.staging
NUXT_SITE_URL=https://staging.example.com
NUXT_SITE_ENV=staging
```

```
# .env.production
NUXT_SITE_URL=https://example.com
NUXT_SITE_ENV=production
```

Non-production environments are automatically blocked from indexing.

Non-production environments are automatically blocked from indexing via the robots module. No need to manually configure `noindex` for staging or preview deployments.

## [Reading Site Config](#reading-site-config)

Access your config anywhere with `useSiteConfig()`:

```
<script setup lang="ts">
const site = useSiteConfig()
// site.url, site.name, site.description, etc.
</script>
```

Works in components, composables, and server routes.

## [Multi-Tenancy](#multi-tenancy)

Serving multiple domains from one Nuxt app? Site Config handles this:

```
export default defineNuxtConfig({
  site: {
    multiTenancy: [
      {
        hosts: ['example.com', 'www.example.com'],
        config: { name: 'Example', url: 'https://example.com' }
      },
      {
        hosts: ['foo.com', 'www.foo.com'],
        config: { name: 'Foo', url: 'https://foo.com' }
      }
    ]
  }
})
```

The correct config loads based on the incoming request hostname.

See the

 for runtime configuration.

[Edit this page](https://github.com/harlan-zw/nuxt-seo/edit/main/docs/content/2.guides/5.site-config.md)

[Markdown For LLMs](https://nuxtseo.com/docs/nuxt-seo/guides/site-config.md)

Did this page help you?

### Related

On this page

- [Quick Setup](#quick-setup)
- [Available Options](#available-options)
- [Environment-Specific Config](#environment-specific-config)
- [Reading Site Config](#reading-site-config)
- [Multi-Tenancy](#multi-tenancy)

[GitHub](https://github.com/harlan-zw/nuxt-seo) [ Discord](https://discord.com/invite/275MBUBvgP)

###

-
-

Modules

-
-
-
-
-
-
-
-
-

###

-
-
-

###

Nuxt

-
-
-
-
-

Vue

-
-
-
-
-
-
-
-

###

-
-
-
-
-
-
-
-
-
-

Copyright © 2023-2026 Harlan Wilton - [MIT License](https://github.com/harlan-zw/nuxt-seo/blob/main/license) · [mdream](https://mdream.dev)