static generation and 404 error #9714
Unanswered
AlexZCP
asked this question in
Questions (Nuxt 2)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everybody! I have some issues with Nuxt generate in static mode.
I'm using Nuxt in combination with Headless CMS. Pages in dynamically building taking data from API.
So in pages folder I have only one file with next structure:
pages
└───_slug
. └───_subslug.vue
In layouts I have next files:
layouts
└───default.vue
└───error.vue
Every time I'm checking if page exists and getting data from API, If not - I'm generating Error 404 using next command:
error({ statusCode: 404, message: "Page not found" })
In dev mode everything works fine. Error page is shown correctly via error.vue
But during generation pages (urls), that doesn't exist, generate empty page
<div id="__nuxt"></div>
.At the same moment in log such pages shows like:
ERROR Error generating route "/resselers": Page Ne Found
generate.fallback property set to '404.html'
In dist/404.html I have loader generated:
<div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div>
How can I cancel generation page at all on 404 page, 'cause anyway nginx operates this via 404 instructions?
Beta Was this translation helpful? Give feedback.
All reactions