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
Document enablePreview #2074
Comments
Hi @mornir Thank you for the detailed issue, indeed we did not have the time to update the documentation yet because I want to release an example using the live preview for this feature. It's on our roadmap :) |
I was too excited about the release, couldn't wait to try the new preview mode out 😋 |
With Nuxt new preview mode, how can we handle previews for unpublished pages? By unpublished pages, I mean pages for which no routes were generated yet. Opening a preview from the CMS for these pages results in a 404. I was hoping that the Nuxt preview mode would let me get rid of the preview route I created exclusively for handling previews. So for now I think that I'm going to keep my current implementation, in |
@mornir Actually we have the SPA fallback that can handle the 404 pages |
@Atinux Hey! Thanks for the reply 😊 Oh! I didn't know that the SPA fallback would still call the API before showing the 404 page, like you explained here However, I was expecting Nuxt to not fall back to the 404 page when calling Visiting generated pages with the preview query parameter overrides the content as expected: However, visiting pages that were not generated and don't exist on the API (usually draft content in CMS is not publicly available) results in a 404, even if the preview mode is activated: |
UPDATE The code snippet below solves the issue: async validate({ app, params, $preview }) {
if ($preview) {
return true
} It would also great to add this gotcha to your live preview example 😁 |
please check if in the the new docs this is explained correctly. thanks for your contributions |
Thanks for the new docs. 😀 |
What problem does this feature solve?
yarn serve
and notyarn dev
(I tested it, in dev mode enablePreview doesn't work as expected in the asyncData hook, which is normal)preview.client.js
Existing sources:
https://github.com/nuxt/nuxt.js/blob/0337932115d4312130d266962d469620378af61c/packages/vue-app/template/index.js#L214
https://nuxtjs.org/blog/going-full-static/
I can submit a contribution to the docs, but I don't know exactly where I should publish it on nuxt.org. Under plugins?
I was thinking that I could also write a real-word example with Sanity CMS and publish it under https://nuxtjs.org/examples
The text was updated successfully, but these errors were encountered: