content
content copied to clipboard
error for markdown files with empty body
Environment
- Operating System: Linux
- Node Version: v18.19.0
- Nuxt Version: 3.10.1
- CLI Version: 3.10.0
- Nitro Version: 2.8.1
- Package Manager: [email protected]
- Builder: -
- User Config: devtools, modules
- Runtime Modules: @nuxt/[email protected]
- Build Modules: -
Reproduction
https://github.com/stefanprobst/issue-nuxt-content
Describe the bug
for a markdown file with an empty body (see this one in the issue repro), i get the following error:
{
"message": "You should use slots with <ContentRenderer>",
"value": {
"_path": "/",
"_dir": "",
"_draft": false,
"_partial": false,
"_locale": "",
"title": "test",
"description": "",
"body": {
"type": "root",
"children": [],
"toc": {
"title": "",
"searchDepth": 2,
"depth": 2,
"links": []
}
},
"_type": "markdown",
"_id": "content:index.md",
"_source": "content",
"_file": "index.md",
"_extension": "md"
},
"excerpt": false,
"tag": "div"
}
instead, i would expect an empty div.
Additional context
No response
Logs
No response
Since you are using ContentRenderer you need to provide an #empty slot to fallback in case the markdown body is empty: https://content.nuxt.com/components/content-renderer#slots
thanks for pointing to that section in the docs!
however, the wording is a bit ambiguous and it's still not 100% clear to me whether i must provide an #empty slot, or if this is a bug ("The empty slot can be used to display a default content when the document is empty").
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.
This issue was closed because it has been stalled for 30 days with no activity.