The <ContentQuery> is a renderless component shortening the access to queryContent().
<!-- Similar to <ContentDoc :path="$route.path" /> -->
<template>
<main>
<ContentQuery :path="$route.path" find="one" v-slot="{ data }">
<ContentRenderer :value="data" />
</ContentQuery>
</main>
</template>
path: The path of the content to load from content source.
stringundefinedonly: Select a subset of fields from an array of keys.
string[]undefinedwithout: Remove a subset of fields from an array of keys.
string[]undefinedwhere: Filter results with a where clause definition.
{ [key: string]: any }undefinedsort: Sort results with a sort clause definition.
SortParamsundefinedlimit: Limit the amount of results.
numberundefinedskip: Skip an amount of results.
numberundefinedlocale: Filter contents based on a locale.
stringundefinedfind: The type of query to be made.
string'one' or 'surround' or undefined.find() will be used if nothing is specifiedThe default slot can be used to render the content via v-slot="{ data }" syntax.
The empty slot can be used to display a default content if the body of the document is empty.
The not-found slot can be used to display a default content before rendering the document.
<template>
<main>
<ContentQuery path="/about/authors" :where="{ type: 'csv' }">
<template #default="{ data }">
<ul>
<li v-for="author of data" :key="author.name">
{{ author.name }}
</li>
</ul>
</template>
<template #not-found>
<p>No authors found.</p>
</template>
</ContentQuery>
</main>
</template>
[
{
"title": "<ContentNavigation>",
"path": "/content-v2/components/content-navigation",
"stem": "content-v2/4.components/3.content-navigation",
"description": "Building complex navigation from your content has never been easier."
},
{
"title": "<ContentSlot>",
"path": "/content-v2/components/content-slot",
"stem": "content-v2/4.components/6.content-slot",
"description": "The fastest way to inject Markdown into your Vue components."
}
]