Open Lexpeartha opened 2 years ago
Nice found @Lexpeartha
I can confirm the bug also applies to my Content Wind template: https://content-wind.nuxt.space/404
I suspect the bug may comr from https://github.com/nuxt/content/blob/main/src/runtime/plugins/documentDriven.ts#L211
Will investigate next week, but happy to get any help if you have some time, you can test the document driven mode using yarn dev document-driven
Alright I found the bug, since you are using nuxt generate
(me too), your page is loaded as SPA fallback (see the page source), so the navigation
object is empty.
This is more instead a feature request to support client-side fallback, cc @farnabaz
@Atinux did you switch to SSR? Opening the error page from your template seems to have a navigation now
Also when I remove /404
from prerendered routes, it still shows blank
Interesting, I think you can make it work for client fallback by using:
export default defineNuxtConfig({
content: {
experimental: {
clientDB: true
}
}
})
It's still empty
Seems your branch does not exist, did you solve your bug?
Seems your branch does not exist, did you solve your bug?
No, just merged it into main 😅 It can still be found there
I played around with it and came across something weird @Atinux, which seems to fixes this in Lexpeartha/portfolio#3
this config doesn't work with SPA fallback and content module
nitro: {
prerender: {
crawlLinks: true,
routes: [
'/',
'/404.html',
'/project/404',
'/sitemap.xml'
]
}
},
However, after adding this:
generate: {
routes: ['/', '/work', '/404']
},
My /404
route seems to have navigation all of the sudden
Not really sure what makes the difference, but wasn't /404.html
in nitro.prerender.routes
supposed to be a special case that is an equivalent of /404
in generate.routes
?
@farnabaz @Atinux I would be more than happy to try and make a PR for this, could you help me with an overview of what to start with/what needs to be done?
Sorry for the late answer @Lexpeartha
If you try to go to /405
on your website, does it work?
You can take a look here. Basically how I set it up is any not recognized route is rendering the same as prerendered /404
Environment
Nuxt project info:
Linux
v16.17.1
3.0.0-rc.13
0.6.1
yarn@1.22.19
vite
modules
,app
,colorMode
,css
,content
,nitro
@nuxt/content@2.2.1
,@nuxtjs/tailwindcss@6.1.3
,@nuxtjs/color-mode@3.1.8
,@vueuse/nuxt@9.4.0
,nuxt-icon@0.1.7
Build Modules:
-
Reproduction
This exact branch: https://github.com/Lexpeartha/portfolio/tree/revert-to-dd
Describe the bug
If you go to page that doesn't exist (and therefore uses
DocumentDrivenNotFound.vue
), it displays navigation without any actual links as it can be seen here. On any other page things work fine. I've even made to sure to explicitly enable DD in the corresponding not found component, but still the same thing.Additional context
No response
Logs
No response