Prerender payloads ignored if linking from 404 page? #2358
Replies: 2 comments
-
Possibly related upstream issue? nuxt/nuxt#18718 |
Beta Was this translation helpful? Give feedback.
-
Ok so in case this helps anyone, the solution for me was to use absolute links in the error page in order to force a reload. It means you lose things like page transitions, but that seems a minor trade off as it's from the error page only. My real world use case is for a fully static site using a mix of markdown content and external CMS/api data. I have a custom 404 page using a base layout which includes a header nav with internal links, which would then break on the error page in SSG build. I wound up creating two versions of this top nav, one with absolute links for the error page, and one standard one with relative links which will pre-fetch as normal in the main context.
The layout then checks
Slightly clunky having to duplicate the nav, but them's the breaks I also wound up ditching nuxt/content's |
Beta Was this translation helpful? Give feedback.
-
In an SSG build, when linking from the nuxt content 404 error page to a standard/non-content Vue page in
pages/
, pre-rendered payloads in the linked page are ignored. Data comes from a server endpoint viauseFetch
I'm not sure if this is a bug/unsupported edge case or if I'm doing something wrong or missing some vital piece of config, so thought I should ask the question here before opening an issue.
I've made a minimal repro here: https://stackblitz.com/edit/nuxt-starter-bl68or?file=README.md
Steps to recreate the behaviour in the repro:
npm run generate
npm run preview
/foo
page should load with correct datafoo
tobaz
and press enter to trigger a 404/foo
page loads but data does not show, as it's trying to fetch from non-existent api instead of using the pre-rendered payloadEverything works as expected under
npm run dev
Beta Was this translation helpful? Give feedback.
All reactions