content icon indicating copy to clipboard operation
content copied to clipboard

Error on Nuxt Content for Static Site Generation : Document not found, overwrite this content with #not-found slot in <ContentDoc>.

Open dawadam opened this issue 1 year ago • 3 comments

Environment

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

  1. Run in dev : npm run dev Appreciate markdown render

  2. Generate npm run generate Check live npm run preview See 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

dawadam avatar Jul 24 '24 10:07 dawadam

Hello @dawadam , I'm also interested in this bug.

Is it possible to prepare this bug reproduction environment in StackBlitz?

shinGangan avatar Aug 04 '24 11:08 shinGangan

@dawadam Have you solved the problem? I can render for the first time, but when I refresh the page it says Document not found

llds66 avatar Aug 27 '24 11:08 llds66

I had the same issue, using this undocumented experimental flag fixed it: https://github.com/nuxt/content/issues/1746#issuecomment-1346737779

Tobberoth avatar Aug 28 '24 13:08 Tobberoth

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?

Adeiko avatar Sep 03 '24 16:09 Adeiko

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.

dawadam avatar Sep 13 '24 12:09 dawadam

Thanks for that. This worked for me: https://github.com/nuxt/content/issues/2726#issuecomment-2315356141

iguilhermeluis avatar Sep 20 '24 18:09 iguilhermeluis

Hi @dawadam , Has this issue already been resolved? If so, it may be ok to close it, are you sure?

shinGangan avatar Oct 15 '24 03:10 shinGangan

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.

dawadam avatar Oct 15 '24 06:10 dawadam

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

dawadam avatar Oct 15 '24 07:10 dawadam