<ContentDoc>The <ContentDoc> component fetches and renders a single document.
An explicit path can be passed to the component with the path prop. If not provided, the $route.path will be used.
It uses <ContentRenderer> and <ContentQuery> under the hood.
tag: The tag to use for the renderer element (if no default slot is provided).
string'div'path: The path of the content to load from content source.
string$route.pathexcerpt: Whether or not to render the excerpt.
booleanfalsequery: A query to be passed to queryContent().
QueryBuilderParamsundefinedhead: Toggles the usage of useContentHead.
booleantrueThe default slot can be used to render the content via v-slot="{ data }" syntax:
<template>
<main>
<ContentDoc v-slot="{ doc }">
<article>
<h1>{{ doc.title }}</h1>
<ContentRenderer :value="doc" />
</article>
</ContentDoc>
</main>
</template>
The not-found slot can be used when no document is found:
<template>
<main>
<ContentDoc>
<template #not-found>
<h1>Document not found</h1>
</template>
</ContentDoc>
</main>
</template>
The empty slot can be used to display a default content before rendering the document.
<template>
<main>
<ContentDoc>
<template #empty>
<h1>Document is empty</h1>
</template>
</ContentDoc>
</main>
</template>
<template>
<main>
<!-- Similar to <ContentDoc :path="$route.path" /> -->
<ContentDoc />
</main>
</template>
<template>
<main>
<ContentDoc path="/about" />
</main>
</template>
<template>
<main>
<ContentDoc>
<template v-slot="{ doc }">
<article>
<h1>{{ doc.title }}</h1>
<ContentRenderer :value="doc" />
</article>
</template>
<template #not-found>
<h1>Document not found</h1>
</template>
</ContentDoc>
</main>
</template>
[
{
"title": "searchContent()",
"path": "/content-v2/composables/search-content",
"stem": "content-v2/3.composables/7.search-content",
"description": ""
},
{
"title": "<ContentRenderer>",
"path": "/content-v2/components/content-renderer",
"stem": "content-v2/4.components/2.content-renderer",
"description": "Takes your component from an AST to a wonderful template."
}
]