bloomreach / spa-sdk

Apache License 2.0
15 stars 16 forks source link

Next.js SSG + Bloomreach visual editing support #9

Closed maciej-dybek-wttech closed 1 year ago

maciej-dybek-wttech commented 1 year ago

Can we create a Next.js application supporting both the Bloomreach Visual Editor and Next.js SSG?

As far as I can see in the examples, pages use the getServerSideProps method. I can imagine using getStaticProps and getStaticPaths for SSG, but is there a way to use such pages with Visual Editor? From what I can see, in order to use the visual editor, the embedded app requires to get query parameters as a configuration with a token allowing to read preview data. How can that work with SSG?

joerideg commented 1 year ago

Hi @maciej-dybek-wttech we dont officially support SSG, but you are welcome to try. Bloomreach platform currently has no webhooks so therefore it would be on you to create some mechanism to notify your build system for changes if you are going to use SSG.

The query parameters with the token are generated by the SDK you should not have to worry about that. Next.js does have preview functionality that should allow you to have a SSR version of your app to be used in the preview.