N
Nuxt3mo ago
Damien

Nuxt Content for Static Site Generation

Hi, I'm 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>.
13 Replies
dwol
dwol3mo ago
You need ssr true for it to create the content correctly. You can still run generate with ssr true.
Damien
Damien3mo ago
Yes, of course. But if i want a static site, i can't use content ?
dwol
dwol3mo ago
Yes you can. Post your nuxt config and what command you’re using to generate
Damien
Damien3mo ago
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: true },
modules: ["vuetify-nuxt-module", "@nuxt/content", "@nuxt/image"],
css: [
"~/layouts/global.css",
],
ssr: false,
spaLoadingTemplate: false
})
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: true },
modules: ["vuetify-nuxt-module", "@nuxt/content", "@nuxt/image"],
css: [
"~/layouts/global.css",
],
ssr: false,
spaLoadingTemplate: false
})
Command is : npm run generate
dwol
dwol3mo ago
this needs to be true. ssr: false,
Damien
Damien3mo ago
What ? "Server side rendering" need to be disabled for static site.
Damien
Damien3mo ago
Nuxt
Rendering Modes · Nuxt
Learn about the different rendering modes available in Nuxt.
Damien
Damien3mo ago
You can enable client-side only rendering with Nuxt in your nuxt.config.ts:
export default defineNuxtConfig({
ssr: false
})
export default defineNuxtConfig({
ssr: false
})
dwol
dwol3mo ago
Read this again
Cue
Cue3mo ago
If you have documentDriven: true and ssr: false, try also enabling experimental: { clientDB: true }
dwol
dwol3mo ago
I've tried this before and it doesn't seem to be very reliable. Didn't spend too much time on it but it wouldn't generate my other locales besides default.
Cue
Cue3mo ago
It’s worth the OP giving it a try since they’re adamant they don’t need ssr enabled (?). No evidence of locales given in their instance.
Damien
Damien3mo ago
With documentDriven: true, same error in production : Document not found, overwrite this content with #not-found slot in <ContentDoc>.
Want results from more Discord servers?
Add your server