This may be a silly question or a pipe dream, but i was wondering if there is a way to have a live preview for entries without a URL. For instance i have a complicated layered slider on the homepage of a site I am building and due to it's complexity it can not simply be a field or series of fields on the homepage entry, thus i've simply created a channel called 'slides' and I include that in my homepage template.

It'd be really great if there was someway to allow live-preview to show the slides while editing, or allow editing of them while in live-preview of the homepage.

Does this capability exist or am I out of luck?

1 Answer 1


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 have to register the URLs. But if you use hidden / pseudo URLs (i.e. hideme/{slug}) that you don't link to and nobody knows of, this shouldn't be that bad of a workaround:

  • You can check if the page is shown with Live Preview using craft.request.isLivePreview. Use this to redirect normal page views (search engines / accidential URL discoveries) to 404 and show your slider for Live Preview requests.
  • Set the Entry Template to the same file you use for your homepage or a new template file where you include the slider partial.

    {# Conditionally show slider or redirect to 404 #}
    {% if craft.request.isLivePreview %}
        {% include '_includes/slider' %}
    {% else %}
        {% redirect 404 %}
    {% endif %}
  • Live Preview doesn't only work for the Entry variable any more (→ Craft 2.3.2616 release notes). So you can make Live Preview to update on changes detected on any entries referenced from the template.

    EDIT: Unsaved entries are not yet included in such craft.entries calls (→ Brandon's comment to my question on g+). As a workaround you could do something like this:


    {# Show unsaved "slider" entry #}
    {% if not entry.id %}
        <li>{{ entry.title }}</li>
    {% endif %}
    {# Go through "slider" entries #}
    {% for slide in craft.entries.section('slides') %}
        {{ slide.title }}
    {% endfor %}

A dedicated field to set the template (or even multiple of them) used for Live Preview would make a nice feature request though! done

  • Carlcs I don't see the ability to set the entry template in the settings since they do not each have their own url? Am I missing something? I'm not really understanding your answer. Thanks. Commented Feb 4, 2015 at 18:44
  • @Christopher ahh right, but what about giving them an (pseudo) URL and not using it?
    – carlcs
    Commented Feb 4, 2015 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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