Index of every page on this site: llms.txt

Why use Nuxt Site Config?

Site config aims to be two things:

  • A single source of truth for site config, for end users and module authors. Multiple modules commonly share this config, filling a gap the Nuxt core does not cover.
  • A set of APIs for working with "writeable runtime config", for end-users and module authors.

Ready to get started? Check out the installation guide.

Features

Site Config Examples

  • url: A canonical site URL is important for SEO and performance.
  • env: The environment the site is running in, important so we can disable indexing for non-production environments. Defaults to Nuxt's current environment name.
  • indexable: Can the site be indexed by search engines? Used by robots and sitemap modules. Sometimes we have production sites that we don't want to be indexed.
  • name: The name of the site is often used in meta tags and other SEO related tags.
  • trailingSlash: Trailing slash consistency avoids duplicate content issues for SEO.

What's the problem?

Not having a single source of truth for site config can be difficult to maintain and error-prone, for end-users and module authors.

Requiring a lot of duplication and boilerplate code to support the same features across modules.

Nuxt Site Config aims to unify the experience of site config with a set of powerful and flexible APIs for end-users and module authors.

Can't we use the Request URL or module config?

Nuxt itself provides a great SSR utility for getting the site URL from the request headers at runtime.

However, this has two major drawbacks:

  • It's not available at build time or when prerendering
  • When used for SEO content, it can cause duplicate content issues if the URL is not the canonical URL (e.g. www.example.com and example.com)

Can't we use site on runtime config?

Yes. In fact, this module uses site on the runtime config under the hood.

It aims to keep all these in sync, resulting in a single source of truth for site config. See How it works for more details.

End goal. We should be able to spin up a multi-tenant or multi-lingual Nuxt app with minimal effort, and Nuxt modules should work, without any additional configuration.

This is far off, but it sets a good direction for the module.

Was this page helpful?