This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

pavsid
pavsid

In a template, i need to check if the page has content. Something like...

{% if !empty(page) %}
    {% page %}
{% else %}
    <p>Coming soon!</p>
{% endif %}

The only way so far i've found is to check the following property... this.page.apiBag.staticPage.attributes.markup

Is this safe to use? Is there a better way?

cgampert51194
cgampert51194

Thank you @pavsid, I don't know if it's safe but it works (builld 461)...

Last updated

neilcarpenter
neilcarpenter

You can use staticPage.content

{% if staticPage.content %}
    <div class="content">
        {% page %}
    </div>
{% endif %}

or

{% if staticPage.content %}
    <div class="content">
        {% component 'staticPage' %}
    </div>
{% endif %}

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.