Forum

Thread tagged as: Question, Problem

Can you put :before and :after inside an :if?

I'm trying to add a multiple item region that only shows up when the content exists. The below works when I have multiple items but goes wrong when there is only one item, when only one item exists the content before doesnt show. Am I doing something wrong or is there a better way to achieve this?

<perch:if exists="destexcerpt">
<perch:before>
    <div>Content before region</div>
</perch:before>
    <div>
      <perch:content id="destexcerpt" type="textarea" html="true" editor="ckeditor" />
    </div>
<perch:after>
    <div>Content after region</div>
</perch:after>
</perch:if>
David Lee

David Lee 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

perch:before is used for the first item only. It looks like you might be better adding a filter for destexcerpt instead.