2

We have a site where Live Preview only works with entries that have been previously published. When trying to preview entries we're working on (or drafts), we see either the latest entry for that section instead - or sometimes the correct entry template but with other/missing data in it.

Puzzled as to what is going on. There are no console errors.

  • Do you have any Routing which may be affecting it? – Matt P Jun 1 '16 at 21:50
  • No, I don't. That did occur to me. – Mike Jun 3 '16 at 5:03
2

My understanding is you have to save an entry first before you can use live preview.

Brandon says as much in his answer here as well:
https://craftcms.stackexchange.com/a/12091/103

  • Thanks for the link. What is odd though is that in Brandon's answer he says it does not matter if the entry is enabled or not. However, if I save and disable the entry, the same behaviour takes place. If I enable the entry then the live preview is fine again. – Mike Jun 3 '16 at 5:07
  • It could be something in your template code that is explicitly hiding disabled entries?? Or perhaps a bug. – Anna_MediaGirl Jun 3 '16 at 5:09
  • Well in testing this more, it seems that when the entry is in disabled mode, the preview always loads the most recent enabled entry - regardless of what section that is from. I cannot see anything else that would prevent this in my template code but that behaviour makes me wonder about how I'm retrieving the entry: {% set entry = craft.entries({ slug: craft.request.getLastSegment() }).first() %} – Mike Jun 8 '16 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.