N
Nuxt6mo 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
dwol6mo ago
You need ssr true for it to create the content correctly. You can still run generate with ssr true.
Damien
DamienOP6mo ago
Yes, of course. But if i want a static site, i can't use content ?
dwol
dwol6mo ago
Yes you can. Post your nuxt config and what command you’re using to generate
Damien
DamienOP5mo 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
dwol5mo ago
this needs to be true. ssr: false,
Damien
DamienOP5mo ago
What ? "Server side rendering" need to be disabled for static site.
Damien
DamienOP5mo ago
Nuxt
Rendering Modes · Nuxt
Learn about the different rendering modes available in Nuxt.
Damien
DamienOP5mo 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
dwol5mo ago
Read this again
Cue
Cue5mo ago
If you have documentDriven: true and ssr: false, try also enabling experimental: { clientDB: true }
dwol
dwol5mo 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
Cue5mo 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
DamienOP5mo 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