How to get Typename from preview with Nuxt ? #1717
Replies: 3 comments
-
You could try appending the
|
Beta Was this translation helpful? Give feedback.
-
I tried but wordpress sends back code and preview_id only What I ended doing is fetch the contentTypeName in graphql based on the node ID, not ideal but functional for now |
Beta Was this translation helpful? Give feedback.
-
Glad to hear you found a workaround. Since we're unable to provide much support for Nuxt at this time, I'll convert this to a discussion and the conversation can continue there. |
Beta Was this translation helpful? Give feedback.
-
I followed this very well done tutorial for faust+Nuxt https://wpengine.com/builders/headless-wordpress-post-previews-in-nuxt-3/
But it gives no real clues to setup previews for multiple content types.
After looking at the faustjs docs I saw some hooks that can help you get the typename using Next but none for Nuxt as the doc doesn't seem to exist yet.
Is there a way to retrieve the typename in Nuxt ?
I thought about storing the value we get from the middleware when wordpress redirects us to a path like :
http://localhost:3000/?p=225&preview=true&previewPathname=%2F%3Fp%3D225&typeName=Post
But it doesn't seem to work as it appears the middleware is never called when I click on the preview button in wordpress admin
Beta Was this translation helpful? Give feedback.
All reactions