docs/2.directory-structure/1.content.md
Nuxt Content reads the content/ directory in your project and parses .md, .yml, .csv and .json files to create a file-based CMS for your application.
::read-more{to="https://content.nuxt.com" target="_blank"} Learn more in Nuxt Content documentation. ::
Install the @nuxt/content module in your project as well as adding it to your nuxt.config.ts with one command:
npx nuxt module add content
Place your markdown files inside the content/ directory:
# Hello Content
The module automatically loads and parses them.
To render content pages, add a catch-all route using the <ContentRenderer> component:
<script lang="ts" setup>
const route = useRoute()
const { data: page } = await useAsyncData(route.path, () => {
return queryCollection('content').path(route.path).first()
})
</script>
<template>
<div>
<header><!-- ... --></header>
<ContentRenderer
v-if="page"
:value="page"
/>
<footer><!-- ... --></footer>
</div>
</template>
::tip{ icon="i-lucide-book" } Head over to https://content.nuxt.com to learn more about the Content module features, such as how to build queries and use Vue components in your Markdown files with the MDC syntax. ::