content
content copied to clipboard
ContentRenderer doesn't work
Hello. everyone. I'm a bit confused when following the documentation
Given I have a markdown file:
/content/article/design.md
---
title: How to design
year: 2023
---
The content of this markdown
In my /pages/article/[...slug].vue
<template>
<main>
<ContentDoc>
<template #default="{ doc }">
<p>{{ doc.title }}</p>
<p>{{ doc.year }}</p>
<ContentRenderer :value="doc"/>
</template>
</ContentDoc>
</main>
</template>
Problem: The title and year is rendered. But the <ContentRenderer> doesn't return anything. Question: What component can I use to render the content from the markdown?
I have tried your code, and it works fine. However, you can also try this: In /pages/article/[...slug].vue
<ContentDoc v-slot="{ doc }">
<article>
<h1>{{ doc.title }}</h1>
<p>{{ doc.year }}</p>
<ContentRenderer :value="doc" />
</article>
</ContentDoc>
You can remove <article>
tag, if it doesn't match your html structure.
Hello, I found that NuxtLayout
created this issue; I'll provide more information soon. Still trying to wrap my head around the issue
I experienced a renderproblem with links in Markdown files in a Nuxt 3 app with Nuxt Content v2. They rendered as plain text and was not clickable. Tried different browsers, incognito, deleted node cache, node_modules, .nuxt. Then i found this issue and removed NuxtLayout from my app.vue file. Then my links in markdown files worked. No solution, but a similar problem i guess? BTW, i upgraded NUXT, Vue, and Nuxt Content to latest versions.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.