You are reading Nuxt Content V1 documentation. Read the latest version
Installation
Install @nuxt/content in only two steps in your Nuxt project.
Add @nuxt/content
dependency to your project:
npx nuxi@latest module add content
Then, add @nuxt/content
to the modules
section of 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 NuxtContext
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 theContext
interface.
Introduction
Empower your NuxtJS application with the @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB-like API, acting as a Git-based Headless CMS.
Writing content
Learn how to write your content/, supporting Markdown, YAML, CSV and JSON.