-
-
Notifications
You must be signed in to change notification settings - Fork 607
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
Nuxt content-driven site problem: queryContent pages giving 404s during generate #2644
Comments
I did try |
do you have you may need the clientDB:
|
There is no more |
That is because the SolutionBy now, I haven't see a proper configuration option to manually include or exclude some paths for nuxt-content. A workaround is using
// nuxt.config.ts
$production: {
routeRules: {
'/': { swr: 900 },
'/blog': { swr: 900 },
'/blog/**': { prerender: true, swr: 900 },
'/api/**': { isr: false },
},
},
$development: {
routeRules: {
'/api/**': { isr: false },
},
}, |
This issue was driving me insane, but I finally have it sorted. My site is a mix of markdown content in /content and vue files in /pages. In the script setup of each of the vue files, add the following, removing those pages from content-driven. |
Sadly, that didn't do it for me -- see https://www.reddit.com/r/Nuxt/comments/14t1fg9/comment/l5gx4a3/ |
I think the the problem has to do with this in the nuxt.config.ts:
It's being set globally. So it's going to affect the entire nuxt configuration globally. It will try to inject into all vue pages it finds. The documentation wasn't really clear, unfortunately, on this. But it's probably why it's an "option" to include. To clarify it will inject in all vue page files (and not just the slug vue file) - which is exactly what you don't want. I personally feel this is a bug, but I can see "why" it's affecting all vue pages you don't want it to affect. I feel that setting documentDriven globally is only for people who aren't mixing and matching content with pages. I would eliminate "documentDriven: true" from the nuxt.config.ts file altogether and simply set it in the respective slug file(s) where you want it to apply. Ie:
This would also eliminate the need to set it "false" or override it on a page by page basis. |
This seems promising! If I remove it from my
My
I note that if I just remove that directive from my |
For completeness, here's most of my site structure:
So where should I apply the directive? Any help appreciated! |
!!! In that case the layouts are not working. Any workaround? |
Environment
Darwin
v18.13.0
3.11.1
3.11.1
2.9.4
[email protected]
-
modules
,app
,content
,tailwindcss
,postcss
,image
,colorMode
,runtimeConfig
@nuxt/[email protected]
,@nuxtjs/[email protected]
,@nuxt/[email protected]
,[email protected]
,@nuxtjs/[email protected]
-
Reproduction
I asked this as a question in the Discussion section a few months ago: nuxt/nuxt#26475
My static site is https://oberbrunner.com and the git repo is at https://github.com/garyo/oberbrunner-website.git.
Check out version 8114db28b44b136 of that repo (that's before I applied a workaround), then do:
and you will get a set of errors during the prerender:
Describe the bug
I can't see what is causing those 404s. More complete logs are in the discussion linked above. It prevents the site from being built. Clearly related to dynamic content somehow; maybe the query results are being stored under different names?
Additional context
No response
Logs
See the discussion at nuxt/nuxt#26475 for complete logs.
The text was updated successfully, but these errors were encountered: