Installation

Add @nuxt/content dependency to your project:

yarn add @nuxt/content
npm install @nuxt/content

Then, add @nuxt/content to the modules section of nuxt.config.js:

nuxt.config.js
{
  modules: [
    '@nuxt/content'
  ],
  content: {
    // Options
  }
}

TypeScript

Add the types to your "types" array in tsconfig.json after the @nuxt/types (Nuxt 2.9.0+) or @nuxt/vue-app entry.

tsconfig.json

{
  "compilerOptions": {
    "types": [
      "@nuxt/types",
      "@nuxt/content"
    ]
  }
}

Why?

Because of the way nuxt works the $content property on the context has to be merged into the nuxt Context interface via declaration merging. Adding @nuxt/content to your types will import the types from the package and make typescript aware of the additions to the Context interface.

On this page