Skip to content
Discussion options

You must be logged in to vote

I haven't spent much time with either Payload or Astro, so there could be a better way but here's a quick and dirty demo I've come up with while experimenting.

Astro components just render down to standard HTML, so you'll just use dom methods to update the content on the page based on the mergedData from the subscribe callback in @payloadcms/live-preview.

Any method will depend on how the data is modeled in Payload. I have a Page collection that has a Blocks field. Each block is a component/section a content author can drop on the page (Hero, Rich Text, CTA Banner, etc).

A Page.astro component renders the page with all the blocks. A script in it subscribes to the updates from live-preview…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@s4pideam
Comment options

Answer selected by s4pideam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants