So I looked at your project and there are no Slice or content in your landing_page type documents that correspond to components in your pages which is most likely breaking your previews in production. It's hard to really know if previews are working locally in your project like this as you have page structures in your project that doesn't match the page structure of the data coming from Prismic.
I would try and have a fully working page locally before testing on Production. Let me know how this goes once you test it.
No unfortunately the project still doesn't work as the data contained in Prismic is not represented on your published pages so I can't start debugging what might be wrong in your production site if I can't see the Prismic content locally. I would recommend having a fully working page with Prismic data before working on Previews. Previews are usually the last thing we work on when we build our Sample projects so that we are sure the data is parsed when delivered form the API.
Also, your page that you are testing with has the uid of test-page when you already have a file in your next.js pages structure of the name test-page, this creates a conflict in Next.js as pre-defined routes take precedence over dynamic routes. So this could be causing you prod issues as the preview cookie might be loaded on the wrong file.
Try starting with our Blog example to see how we recommend configuring your project:
I tested that page as well and none of the content from Prismic is templated there, only the word Post. This is because your link resolver is directing anything from the landing_page custom type towards the the [uid].js file. You can learn about how the link resolver works here:
Preview mode uses the link resolver to find the page on which to load your content.
So I deployed your application on Vercel and saw this warning:
warn - Statically exporting a Next.js application via `next export` disables API routes.
This means previews are being disabled.
To fix this for now, in your package.json change...
"build": "next build && next export",
to...
"build": "next build",
Your website will still be deployed statically, it will just allow previews to work. To quote the Next.js docs link above:
Pages in your application without server-side data dependencies will be automatically statically exported by next build , including pages powered by getStaticProps
Let me know if this is clear for you.
Thanks.
system
(system)
closed as resolved, flag & select 'Something Else' to reopen.
14
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.