I've got a Matrix block in my Latest News/Index template and I can't figure out how to only output the first instance of a block type field.
Here is my code, working great except it outputs the first 250 characters from ALL {{block.newsContent}}
content block fields not just the first. I know this is what my code is actually set up to do, but I can't figure out how to only output the first one!
{% for block in entry.newsBlock %}
{% switch block.type %}
{% case 'nbTitle' %}
<a href="{{ entry.url }}"> <h2> {{ block.newsTitle }} </h2></a>
<h3>{{ entry.postDate | date("d-M-Y") }}</h3>
{% case 'nbContent' %}
<div class="news-content-index">
<p>{{ block.newsContent | striptags | slice(0, 250) ~ '...' }}</p>
</div>
{% endswitch %}
{% endfor %}
The {{block.newsContent}}
part outputs every instance of that field, but I only need the first, as it's the 'excerpt' intro to the complete article.
Here is the front end: https://www.ancamotion.com/latest-news
Any help appreciated, thanks!