#nuxt/content ssr?
1 messages · Page 1 of 1 (latest)
The knowledge sources don’t directly describe SSR problems specific to @nuxt/content blog routes, so I can’t give a precise, guaranteed fix. But a few relevant points are clear:
-
Nuxt 3 + Nuxt Content is SSR-capable by default
Nuxt 3 apps are server‑rendered unless you explicitly disable SSR (globally or via route rules). If your/blogpages only render after client navigation, it usually means:- SSR is disabled (e.g.
ssr: falseinnuxt.configor a route rule like{ '/blog/**': { ssr: false } }), or - The content is rendered in a purely client‑only component (e.g. using browser‑only APIs).
There’s no indication in the sources that
@nuxt/contentitself prevents SSR. - SSR is disabled (e.g.
-
How to check if your blog is actually SSR’d
One source shows how to verify whether a page and its content are server‑rendered:- In the browser devtools console, run:
If it’swindow.__NUXT__.serverRenderedtrue, the page is SSR’d. [Is content SSR] - Or use “View Page Source” and search for some unique blog text; if it appears in the HTML source, that content was rendered on the server. [Is content SSR]
If a hard reload of
/blog/[slug]shows no blog text in “View Page Source”, then that content is not being SSR’d. - In the browser devtools console, run:
-
Client-only vs server components
Another source shows using a.server.vuecomponent to ensure markdown is rendered on the server for SEO. [Markdown SSR]
If your blog rendering lives in a client‑only component (or uses browser‑only APIs), Nuxt will push that work to the client and you’ll see exactly the behavior you describe (nothing on hard reload, content appears only after hydration).
In that example, they:
- Enable
experimental.componentIslandsinnuxt.config - Create
HighlightedMarkdown.server.vuethat converts markdown to HTML on the server and outputs it withv-html. [Markdown SSR]
The same pattern can be used for blog content: ensure the component that turns markdown/content into HTML is allowed to run on the server (e.g. not marked client‑only).
- What I can’t see from the sources
- There’s no explicit mention of a bug where
@nuxt/contentpages fail on hard reload. - There’s no concrete
nuxt.configexample for@nuxt/content+ SSR in these documents.
- There’s no explicit mention of a bug where
Because of that, I can’t say exactly why your /blog/* fails on reload, only that:
- Nuxt 3 SSR works and can be verified as above. [Is content SSR]
- Server‑side markdown rendering for SEO is possible and demonstrated with a
.server.vuecomponent. [Markdown SSR]
If you share your nuxt.config and how you render the blog content (page + components), you can compare against these two checks:
- Is SSR globally or per‑route disabled?
- Is the component that renders the blog content allowed to run on the server (not client‑only, not using browser‑only APIs)?
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@neat flame Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@cinder steppe
Let me check the knowledge base for you again. One moment! :books: