emilpriver / jamstack-preview-and-deployments

Preview and deploy NextJS applications from the wordpress admin.
17 stars 1 forks source link

Should this plugin still work? Installation does not change preview url. #27

Closed dnspnjrs closed 2 years ago

dnspnjrs commented 2 years ago

Ive been searching for such a thing for quite some time. But im wondering if it still works? I've installed the plugin and filled out the settings accordingly. The preview URL does not change on posts / custom post types.

Thanks!

emilpriver commented 2 years ago

Hello, have u checked that preview is enabled for the post type ? Could you send a screenshot of your settings?`Dont forget to hide secrets!

dnspnjrs commented 2 years ago

Hello, have u checked that preview is enabled for the post type ? Could you send a screenshot of your settings?`Dont forget to hide secrets!

Thanks for your message!

Ill clarify:

Expected result: Plugin adds id, secret and postType to the preview url.

View attached screenshots for details. Plugin doesn't add the url on custom post type or a page.

Settings page: Screenshot 2021-11-09 at 08 55 55

When hovering Custom post type: Screenshot 2021-11-09 at 08 57 05

dnspnjrs commented 2 years ago

Allright

Hello, have u checked that preview is enabled for the post type ? Could you send a screenshot of your settings?`Dont forget to hide secrets!

Thanks for your message!

Ill clarify:

  • I have a clean setup of nextjs / wordpress 5.8.1 with 1 custom post type
  • In wordpress "custom post type" settings the option "revisions" is enabled
  • Preview URL and Preview "secret" are added

Expected result: Plugin adds id, secret and postType to the preview url.

Allright, I see that the plugin doesn't take in account a different "Site Address". When I changed the "Wordpress Address" to match the "Site Address" the plugin works for previewing posts.

The only issue now is that GraphQL doesn't query unpublished posts. Is there a way you found a solution around this?

emilpriver commented 2 years ago

Hello, You need to handle the preview function yourself. Have you built an endpoint to handle the preview call? We use GraphQL with WordPress at work and the difference is that we tell GraphQL to show us a preview post or a "revision" as WordPress calls it. I recommend you looking at the examples made by next.js with Wordpress or this page: https://nextjs.org/docs/advanced-features/preview-mode. This issue show how the query asPreview which you use to get preview data.

Closeing issue as problem is not with the plugin