8
votes
Live preview not automatically updating
There is a known issue where if you use a variable name 'entry' in any template involved in a Live Preview request (including layout templates), then it can cause the behavior you're seeing.
Some ...
7
votes
No live preview available when entry status is set to disabled?
Live Preview will be available when the following are true:
The section’s “Entries in this section have their own URLs” setting is checked
The section’s “Entry Template” setting points to a valid ...
7
votes
Accepted
Live Preview has No Style
Not sure what your end url is but I think you'll need either a "/" or {{ siteUrl }} before "assets" in "assets/bootstrap/css/bootstrap.min.css".
so (for all references to css etc.)
<link href="{{ ...
6
votes
Live Preview not working
Just want to mention for anyone running across this thread that if you're having a problem with live preview and seeing dev tools errors of the nature of cors or crossdomain then the first thing you ...
6
votes
Live Preview not working
Another cause of Live Preview not working that can be a pain to debug, because there are no 'errors' as such is your .htaccess setup. For example, on one site we had the following .htaccess entry to ...
6
votes
Accepted
Live preview using Vue.js
Craft 3.2 introduces Headless Preview which works a treat with SPA's. Essentially Craft exposes tokens which you can forward on to subsequent Element API requests and Craft will do the rest. The ...
5
votes
Accepted
Is it possible to prevent disabled Matrix Blocks showing in a Live Preview?
It's definitely a bug in live preview but looks like you can work around it.
This doesn't appear documented at all—so be careful—but you can use .status() to get the block's status. It looks like an ...
5
votes
Accepted
When using .limit on matrix blocks they don't show in live preview
I noticed the same issue with live preview, but using the type property on the Matrix field: Issue with Matrix type property and Live Preview? According to Brandon's answer this is a current bug / ...
5
votes
Accepted
Issue with Matrix `type` property and Live Preview?
Live preview have gone through a major refactoring for Craft 3.2, which addresses this issue. For Craft 3.1 and below see solutions below.
This is happening because Matrix will only show the non-live ...
5
votes
Accepted
Apply different classes and styles when in 'live preview' pane
Craft's Request service has a built-in method for this, isLivePreview.
Here's how to only display content in the live preview view:
{% if craft.request.isLivePreview %}
<p>Only appears in ...
4
votes
Accepted
Live Preview only works for Entry variable?
We just changed this behavior in Craft 2.3.2616:
Live Preview and Share links will now show the unpublished entry/category changes wherever the entry/category are being referenced in the templates (...
4
votes
Live Preview not working
Accepted answer helped me, my issue was Ajax related as well! Here is an example of the code I ended up using in my template.
{% extends (craft.request.isAjax and not craft.request.isLivePreview) ? "...
4
votes
Accepted
Description and logo at the very top of browser?
Site title - This is set with HTML meta tags and not really anything to do with Craft specifically. It depends how you "switched" from wordpress to Craft. Inside your document head, you need to ...
4
votes
Accepted
What configuration does Craft need to enable Live View on hoster CloudFlare with SSL/https CP?
I'm not completely sure, but would setting site_url to always be whatever the server host is work in this case? In my general.php I use the following before the config array:
$protocol = (isset($...
3
votes
Multi locale, multi-domain Live Preview failing
Only setting headers in .htaccess doesn't fix the problem.
As Marion Newlevant points out in her answer the cross domain works with the headers set. But you still get a white page as a preview.
...
3
votes
Accepted
Live Preview error when entry is disabled
Change:
{% for entry in craft.entries.section('flashback') %}
To:
{% for entry in craft.entries.section('flashback').status(null) %}
The 2nd one will grab all entries regardless of their enabled/...
3
votes
Accepted
Does Google Analytics track Live Preview 'page views'?
If you're using SEOmatic - no. It's built in that the GA doesn't get spat out for the preview. If you're using a regular template - yes; you may want to wrap your GA code in a conditional so that it's ...
3
votes
Live Preview failing in Safari and Firefox only
CORS (or Cross-Origin Resource Sharing) issues usually occur when you are attempting to load a resource such as a font, a stylesheet, or a script from a remote location that does not give your domain ...
3
votes
Accepted
Live Preview failing in Safari and Firefox only
Ok, so after going through the logs in craft/storage/runtime I found the problem.
I'm using environment variables for my sites url and had it set to:
mysite.com
However when going to the site ...
3
votes
Accepted
Two domains - single install - Live Preview works only on one
In order to get Live Preview to work across different subdomains on a single install, you'll need to setup a few extra things as outlined in this support article: https://craftcms.com/support/cross-...
3
votes
Live preview using Vue.js
Update:
As of Craft 3.2 there is native support for headless previews. Please
see Cue's extensive answer for a detailed
explanation.
Original answer
I managed to do this, although I'm still not quite ...
3
votes
Headless CraftCMS: How can I tell Craft to load live preview from a different (sub)domain?
Since Craft 3.3.1, you can create a custom alias that resolves to your frontend base URL, and add that alias to the relevant preview targets' "URL Format" setting.
For example, assuming you put ...
2
votes
Live preview not automatically updating
Be sure to look for JavaScript errors as well! I was having the same trouble with a CloudFlare-enabled site, and it turned out that the Rocket Loader feature was choking and keeping previews from ...
2
votes
Live Preview and Twig blocks
The problem was my attempt to ajaxify the page.
I had my block content wrapped around
{% if not craft.request.isAjax %}
the page also gets loaded in via Ajax into the control panel, I changed the ...
2
votes
Accepted
Live Preview not working
Looks like it's generating a 500 Internal Server Error which means the underlying error message should be getting logged into your craft/storage/runtime/logs files. Just reproduce the problem and ...
2
votes
Live Preview only works for Entry variable?
Update:
Thanks to P&T this workaround is not necessary any more with Craft 2.3.2616!
This was my temporary solution / bugfix:
I think you're right, Live Preview seems to only update if changes ...
2
votes
Accepted
Live Preview Items Without Entry URL
It is (currently) not possible to set an Entry Template without selecting "Entries in this section have their own URLs" in the settings.
So to make Live Preview available on your "slides" entries, you ...
2
votes
Previewing different languages
If you define your base site URLs using the siteUrl config setting (using the array syntax), then clicking the “Share” button should bring you to the appropriate locale’s URL.
2
votes
Live Preview: Hide tabs from live preview
There is currently no out-of-the-box way to do that.
You might be able to pull it off with something like the CP-CSS plugin, but I'm not sure how you'd just target the tab when the Live Preview pane ...
2
votes
Live Preview not working
Another possible source of Live Preview not working is your siteUrl config setting pointing to the wrong environment in a multi-environment setting.
I had this problem when I'd set siteUrl globally ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
live-preview × 66craft3 × 6
templating × 6
control-panel × 6
matrix × 5
multi-site × 5
javascript × 4
headless × 4
plugin-development × 3
localization × 3
config × 2
cache × 2
events × 2
htaccess × 2
multi-domain × 2
entries × 1
plugins × 1
error-message × 1
datetime × 1
performance × 1
frontend × 1
craft-features × 1
globals × 1
404 × 1
nginx × 1