1

On multisite setup, I have problem to get LivePreview working (Craft 3.3.4). I have one domain live, other not, so it displays Maintenance Page. But I need the editors to edit the entries on that domain and check them in LivePreview.

My templates begin like this:

{% if not currentUser %}
  {% include "_main/maintenance_page" %}
{% else %}
  {% include "_main/general_page" %}
{% endif %}

It should show the page when the user is logged in. But this doesn't work in LivePreview. Maintenance page is displayed in LP, what is not what I need to achieve.

I have also tried

{% if craft.app.request.isLivePreview %}

but it returns FALSE for the inactive domain, when tested on LivePreview. So it is not working neither.

Am I missing something? There is no guide in the Docs, afaik.

Thanks

1

I have found the solution to my problem.

{% if craft.app.request.isPreview %}
    THIS WILL BE SHOWN IN LIVE PREVIEW,
    even if Your domains are
    www.main-cp-domain.com
    www.second-domain.com
{% else %}
   THIS WILL APPEAR TO ANYONE ON FRONTED
{% endif %}

So it does what I need. However, I don't get why craft.app.request.isLivePreview and currentUser are not working in LivePreview, when editing entries for second-domain.com

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.