Nuxt Content will automatically generate paths for your content files.
| File | Internal path |
|---|---|
content/index.md | / |
content/about.md | /about |
content/blog/index.md | /blog |
content/blog/hello.md | /blog/hello |
content/1.guide/2.installation | /guide/installation |
The module creates REST GET endpoints for every document in the content/ directory reachable with the /api/_content/query route.
Components and pages can query contents using queryContent().
Add numeric prefixes to files and directories inside the content/ directory to specify an order.
Nuxt Content uses these numbers to order content lists.
content/
1.frameworks/
1.vue.md
2.nuxt.md
2.examples/
1.vercel.md
2.netlify.md
3.heroku.md
index.md
Content module will ignore files and folders starting with a ..
content/
1.frameworks/
.1.vue.md // Ignored content
2.nuxt.md
.2.translation/ // Ignored directory
1.fa/
1.messages.md // Ignored content because of its grand parent
2.fr/
1.messages.md // Ignored content because of its grand parent
Adding _ prefix to files will mark them as partial contents.
Partial contents are accessible in search and content lists but are not displayed in content navigation.
content/
1.frameworks/
_1.vue.md // Partial content
2.nuxt.md
_2.translation/ // Partial directory
1.fa/
1.messages.md // Partial content because of its grand parent
2.fr/
1.messages.md // Partial content because of its grand parent
You can query partials by using queryContent().where({ _partial: true }).
[
{
"title": "Migration",
"path": "/content-v2/get-started/from-v1",
"stem": "content-v2/1.get-started/5.from-v1",
"description": "Learn how to upgrade from Nuxt Content V1 to Nuxt Content V2 with Nuxt 3."
},
{
"title": "JSON, YAML, CSV",
"path": "/content-v2/usage/files",
"stem": "content-v2/2.usage/3.files",
"description": "Nuxt Content can also query JSON, YAML and CSV content."
}
]