I have an item that has related entries to it. I want to output the position that item is within the related entries and the total of related entries also. e.g. 2 of 7

I've figured out how to get the total of related entries, but not the position within that total.

{% for relatedSermons in craft.entries.section('sermonSeries') %}
{% set numRelatedSermons = craft.entries.section('sermons').relatedTo(relatedSermons).total() %}
<h2>Sermons in this Series {{numRelatedSermons}}</h2>
{% endfor %}
  • Maybe something like {{ '{index}/{total}' | t({ index: loop.index, total: craft.entries.section('sermons').relatedTo(relatedSermons).total() }}? – Romain Poirier Mar 2 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.