---
title: "ContentRenderer"
description: "Takes your component from an AST to a wonderful template."
canonical_url: "https://content.nuxt.com/docs/components/content-renderer"
---
# ContentRenderer

> Takes your component from an AST to a wonderful template.

The `<ContentRenderer>` component renders a document coming from a query with [`queryCollection()`](https://content.nuxt.com/docs/utils/query-collection).

<note>

This component **only works** with `Markdown` files.

</note>

## Props

| Prop | Default | Type | Description |
| --- | --- | --- | --- |
| `value` | `{}` | `ParsedContent` | The document to render. |
| `tag` | `'div'` | `string` | The tag to use for the renderer element if it is used. |
| `excerpt` | `false` | `boolean` | Whether to render the excerpt only without the rest of the content. |
| `components` | `{}` | `object` | The map of custom components to use for rendering. This prop will pass to the markdown renderer and will not affect other file types. |
| `data` | `{}` | `object` (required) | A map of variables to inject into the markdown content for later use in binding variables. |
| `prose` | `undefined` | `boolean` | Whether or not to render Prose components instead of HTML tags. |
| `class` | `undefined` | `string` or `object` | Root tag to use for rendering. |
| `unwrap` | `false` | `boolean` or `string` | Tags to unwrap separated by spaces. Example: `'ul li'`. |

## Example Usage

```vue [pages/[...slug].vue]
<script lang="ts" setup>
const route = useRoute()
const { data: page } = await useAsyncData(route.path, () => {
  return queryCollection('docs').path(route.path).first()
})
</script>

<template>
  <ContentRenderer v-if="page" :value="page" />
</template>
```

## Handling Missing Pages

If the queried content is **missing**, you can display a **custom fallback message**.

```vue [pages/[...slug].vue]
<script lang="ts" setup>
const route = useRoute()
const { data: page } = await useAsyncData(route.path, () => {
  return queryCollection('docs').path(route.path).first()
})
</script>

<template>
  <template v-if="page">
    <ContentRenderer :value="page" />
  </template>
  <template v-else>
    <div class="empty-page">
      <h1>Page Not Found</h1>
      <p>Oops! The content you're looking for doesn't exist.</p>
      <NuxtLink to="/">Go back home</NuxtLink>
    </div>
  </template>
</template>
```


## Sitemap

See the full [sitemap](https://content.nuxt.com/sitemap.md) for all pages.
