Installation

Install @nuxt/content in only two steps in your Nuxt project.


Add @nuxt/content dependency to your project:

Yarn
yarn add @nuxt/content@^1
NPM
npm install @nuxt/content@^1

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.