Unsure on how to implement previews

I've followed this guide


I'm trying to get previews to work in an Elixir and Phoenix stack using their liveview technology. I've successfully decoded the cookie with name io.prismic.preview and these are the bits of data I've got

   "_tracker" => "xyzxyzxyz",
   "repo-name.prismic.io" => %{
       "preview" => "https://repo-name.prismic.io/previews/xyzxyzxyz?websitePreviewId=xyzxyzxyz"

From the documentation I've read on previews I should have a prismic-ref within this data. How this looks like it could be either of the tokens within the URL.

I've been using this URL for my graphql queries https://my-repo.cdn.prismic.io/graphql?query=#{query} and setting Prismic-ref with the ref that comes back from an info request.

I've tried using the tokens but neither work in returning data as I would expect. Any help would be much appreciated as I think I'm either daft or the documentation is out of date.

Hah! Nothing like a good sleep to sort your brain out.

I went back and read the docs again this morning :blush: and I'm now just setting the cookie value as the ref without doing anything to it. It's now working. :man_shrugging:

Thanks for being my :duck: programmer.

1 Like

Hey Neil,

Welcome to the community! Glad you worked this one out. Let us know if you need anything else.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.