Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dawadam opened this issue Jul 24, 2024 · 9 comments

Comments

@dawadam
Copy link

dawadam commented Jul 24, 2024

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

@shinGangan
Copy link
Contributor

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

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

@llds66
Copy link

llds66 commented Aug 27, 2024

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

@Tobberoth
Copy link

I had the same issue, using this undocumented experimental flag fixed it:
#1746 (comment)

@Adeiko
Copy link

Adeiko commented Sep 3, 2024

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?

@dawadam
Copy link
Author

dawadam commented Sep 13, 2024

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.

@iguilhermeluis
Copy link

Thanks for that. This worked for me:
#2726 (comment)

@shinGangan
Copy link
Contributor

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

@dawadam
Copy link
Author

dawadam commented Oct 15, 2024

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
Copy link
Author

dawadam commented Oct 15, 2024

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 dawadam closed this as completed Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants