Configuration

Gitlab
Discover all the options you can use in your nuxt.config.ts file.
Added since: v1.0.0
Last changed:

statamic

baseUrl

  • Default: process.env.NUXT_PUBLIC_STATAMIC_URL
  • Type: string
Use the baseUrl option to set the base URL of the Statamic CMS.
The module removes the trailing slash from the baseUrl automatically.
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-statamic'],
  statamic: {
    // Not recommended but possible, rather use the .env file instead.
    baseUrl: 'https://your-statamic-api-url.com',
  },
});

debug

  • Default: process.env.NUXT_DEBUG or false
  • Type: boolean
Set to true to enable additional logging and debugging information.
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-statamic'],
  statamic: {
    debug: true,
  },
});

i18n

This option requires the @nuxtjs/i18n module to be installed and configured in your project. (v10 or higher)
  • Default: false
  • Type: boolean
Set to true to enable i18n support for the module.

When enabled, the module provides additional composables for working with i18n and will set certain options/ parameters for the Statamic API requests.
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-statamic'],
  statamic: {
    i18n: true,
  },
});

multiTenancy

This option requires the @nobears-front-end/nuxt-multi-tenancy module to be installed and configured in your project.
  • Since: v1.1.0
  • Default: false
  • Type: boolean
Set to true to enable multi-tenancy support for the module.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-statamic'],
  statamic: {
    multiTenancy: true,
  },
});
  • Default: []
  • Type:
    type 
    NavigationsOptions
    =
    Array
    <
    SingleNavigationsOption
    | string>;
When set, the module will fetch the navigations from the Statamic API and will automatically refresh the navigations when either the locale or the site changes.
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-statamic'],
  statamic: {
    navigations: [
      'main',
      {
        handle: 'footer',
        fields: ['title', 'links'],
      },
    ],
  },
});

redirects

  • Default: false
  • Type: boolean
Use the redirects option to enable redirects support for the module.

When enabled, the module will fetch the redirects from the Statamic API and will apply a global middleware to automatically redirect to the correct URL.
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-statamic'],
  statamic: {
    redirects: true,
  },
});

seo

  • Default: false | { sitemap: { path: "/sitemap.xml" }, titleTemplate: "%s" }
  • Type:
    type 
    SeoOptions
    = {
    sitemap
    ?: {
    path
    ?: string;
    } | boolean;
    titleTemplate
    ?: string;
    ogImageTemplate
    ?: string;
    } | boolean;
Use the seo option to enable SEO support for the module.

When enabled, the module provides composables for working with seo and will set certain options/ parameters for the Statamic API requests. Along with a default sitemap configuration.

When set to true or an object, the module will apply the following default configuration and override with the provided options:
{
  "sitemap": {
    "path": "/sitemap.xml"
  },
  "titleTemplate": "%s"
}
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-statamic'],
  statamic: {
    seo: true,
    // or
    seo: {
      sitemap: {
        path: "/sitemap.xml",
      },
      titleTemplate: "%s",
    },
  },
});

server

  • Default:
    {
      api: {
        globals: {
          maxAge: 60 * 60
        },
        navigations: {
          maxAge: 60 * 60
        },
        redirects: {
          maxAge: 60 * 60 * 24
        },
        sitemap: {
          maxAge: 60 * 60 * 24
        }
      }
    }
    
  • Type:
    type 
    ServerOptions
    = {
    /** * API endpoints configuration */
    api
    ?: {
    globals
    ?:
    GlobalsCacheOptions
    ;
    navigations
    ?:
    NavigationsCacheOptions
    ;
    redirects
    ?:
    RedirectsCacheOptions
    ;
    sitemap
    ?:
    SitemapCacheOptions
    ;
    }; };
Use the server option to configure the server side caching for the module.

This option allows you to customize the maxAge (cache duration) for the globals, navigations, redirects and sitemap server side endpoints.
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-statamic'],
  statamic: {
    server: {
      api: {
        globals: {
          maxAge: 60 * 60,
        },
        // ...
      },
    },
  },
});

Changelog

v1.1.0

on

#e4e1a19f

-

feat: added support for @nobears-front-end/nuxt-multi-tenancy

v1.0.0

on

#407d36db

-

feat: released initial version of nuxt-statamic