dijkr / Copia

Laravel-project with CMS
0 stars 0 forks source link

Only display a collection if its published #31

Closed dijkr closed 1 year ago

dijkr commented 1 year ago

The view tries to display results, when nothing is published. It would be nice it display nothing or display something to mitigate the issue.

dijkr commented 1 year ago

Solutions, using an if-statement within the collection:

    {{ collection:home }}
        {{ if published }}
            <div class="aanbiedingsactie">
    {{#         <div class="aanbiedingsactie-item"> #}}
                {{ glide }}
                <img src="{{ banner_pm }}"/>
                {{ /glide }}
                <div class="text-overlay-actie">
                    <h2> {{ title }}</h2>
                    <h3> {{ subtitle }}</h3>
                    <a href="/aanbiedingen">Aanbiedingen</a>
    {{#             </div> #}}
                </div>
            </div>
        {{ else }}
                <p><h3>Binnenkort volgen er weer nieuwe acties!</h3></p>
        {{ /if }}
    {{ /collection:home }}