Hello,
There is a page with title Germany displaying offers available in Germany. I would like to display “No offers” if there are no offers available in Germany.
I could add {{ else }}<p>No offers</p>{{ end }}
, but text will be displayed each time when offer does not have tag equal to Germany. How can I show text only once?
Maybe there is better way to get only needed posts/offers?
<section class="tiles">
{{ $filter := .Title }}
{{ range $offer := ((.Site.GetPage "section" "/offer").Pages).ByDate.Reverse }}
{{ if in .Params.tags $filter }}
<article class="{{ $offer.Params.home_style }}">
<span class="image">
<img src="{{ $offer.Params.home_img | relURL }}" alt="" />
</span>
<a href="{{ $offer.URL }}">
<h3>{{ $offer.Title }}</h3>
<div class="content">
{{ partial "markdownify-block" $offer.Params.excerpt }}
</div>
</a>
</article>
{{ end }}
{{ end }}
</section>