Error on Nuxt Content for Static Site Generation : Document not found, overwrite this content with #not-found slot in <ContentDoc>.
Environment
- Operating System: Linux
- Node Version: v20.15.1
- Nuxt Version: 3.12.4
- CLI Version: 3.12.0
- Nitro Version: 2.9.7
- Package Manager: [email protected]
- Builder: -
- User Config: compatibilityDate, devtools, modules, ssr, spaLoadingTemplate, hooks
- Runtime Modules: [email protected], @nuxt/[email protected], @nuxt/[email protected]
- Build Modules: -
Reproduction
Just install fresh nuxt and module @nuxt/content.
Add a markdown file in "content" folder.
Add a page in "pages" folder with <ContentDoc />
Add to nuxt config : ssr:false
-
Run in dev :
npm run devAppreciate markdown render -
Generate
npm run generateCheck livenpm run previewSee error :Document not found, overwrite this content with #not-found slot in <ContentDoc>.
Describe the bug
When using Nuxt Content with markdown files. It works fine in development and when I generate production builds. The problem occurs when I try to disable SSR (Server-Side Rendering). An error appears when loading a markdown file:
Document not found, overwrite this content with #not-found slot in <ContentDoc>.
Additional context
No response
Logs
No response
Hello @dawadam , I'm also interested in this bug.
Is it possible to prepare this bug reproduction environment in StackBlitz?
@dawadam Have you solved the problem?
I can render for the first time, but when I refresh the page it says Document not found
I had the same issue, using this undocumented experimental flag fixed it: https://github.com/nuxt/content/issues/1746#issuecomment-1346737779
I had the same issue, using this undocumented experimental flag fixed it: #1746 (comment)
It's surprising that this solution is so hidden. After spending hours trying to troubleshoot, simply adding this parameter to the Nuxt config resolved everything:
content: {
experimental: {
clientDB: true
}
}
This option isn’t even mentioned in the main documentation:
https://content.nuxt.com/get-started/configuration#experimental
Is there a specific reason why this isn’t documented?
I had the same issue, using this undocumented experimental flag fixed it: #1746 (comment)
It's surprising that this solution is so hidden. After spending hours trying to troubleshoot, simply adding this parameter to the Nuxt config resolved everything:
content: { experimental: { clientDB: true } }This option isn’t even mentioned in the main documentation:
https://content.nuxt.com/get-started/configuration#experimental
Is there a specific reason why this isn’t documented?
Thanks for that. It rings a bell, if it works I’ll need to try it again. I hadn't found the solution yet @shinGangan and @llds66.
Thanks for that. This worked for me: https://github.com/nuxt/content/issues/2726#issuecomment-2315356141
Hi @dawadam , Has this issue already been resolved? If so, it may be ok to close it, are you sure?
Hi @dawadam , Has this issue already been resolved? If so, it may be ok to close it, are you sure?
I will give it a try to verify.
Installation (Nuxt + Content) :
npx nuxi@latest init content-app -t content
Change the configuration in nuxt.config.ts to disable server-side rendering:
export default defineNuxtConfig({
ssr: false,
// ...
});
Starting development:
npm run dev
Go to the article slug page:
http://localhost:3000/about
Working as expected: "About Content v2"
Generating for production:
npm run generate
Starting preview:
npm run preview
Go to the article slug page:
http://localhost:3000/about
See error:
Document not found, overwrite this content with #not-found slot in <ContentDoc>.
Apply @Adeiko's suggestion in nuxt.config.ts:
export default defineNuxtConfig({
ssr: false,
content: {
experimental: {
clientDB: true
}
},
// ...
});
Generating for production:
npm run generate
Starting preview:
npm run preview
Go to the article slug page:
http://localhost:3000/about
Now it works: "About Content v2"
It should be added to the documentation! :)
PS : @shinGangan i'm not usung StackBlitz