<p>I don't know if this is the best solution or if it will even work, but this would be my first try.</p>

<pre><code>{% for spotlight in craft.entries().section('spotlights').all() %}
  {# Check to see if the title of the "spotlight" matches the current entry's title #}
  {% if spotlight.title == entry.title %}
    &lt;div class="entry-count"&gt;{{ loop.index }} of {{ total }}&lt;/div&gt;
  {% endif %}
{% endfor %}
</code></pre>

CC BY-SA 4.0
2020-04-29T17:32:03.280Z
2020-04-29T17:32:03.280Z
Jon Weedin
<p>I have a channel which has multiple entries in, I'm trying to output the current entry number, for example "<strong>1</strong> out of 20 posts"</p>

<p>Currently this is what I am working with:</p>

<pre><code>{% set total = craft.entries().section('spotlights').count() %}
{% set params = {section: 'spotlights', order: 'postDate desc', limit: null} %}
{% set entry_prev = entry.getPrev(params) %}
{% set entry_next = entry.getNext(params) %}

&lt;section class="page-nav-wrapper"&gt;
  &lt;div class="container"&gt;
    &lt;div class="page-nav"&gt;
      {% if entry_prev %}
      &lt;div class="previous-page"&gt;
        &lt;a href="{{entry_prev.url}}"&gt;Previous&lt;/a&gt;
      &lt;/div&gt;
      {% else %}
      &lt;div class="previous-page"&gt;
        &lt;a class="disabled"&gt;Previous&lt;/a&gt;
      &lt;/div&gt;
      {% endif %}
      &lt;div class="entry-count"&gt;ENTRY NUMBER HERE of {{ total }}&lt;/div&gt;
      {% if entry_next %}
      &lt;div class="next-page"&gt;
        &lt;a href="{{entry_next.url}}"&gt;Next&lt;/a&gt;
      &lt;/div&gt;
      {% else %}
      &lt;div class="next-page"&gt;
        &lt;a class="disabled"&gt;Next&lt;/a&gt;
      &lt;/div&gt;
      {% endif %}
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/section&gt;
</code></pre>

<p>I have my next and previous links working as well as the total entries in the section, I just can't work out how to get the current entry in the section. Any help would be appreciated.</p>

<p>I have tried a few different solutions on here but they all seem to be outdated.</p>

<p>Thanks.</p>

CC BY-SA 4.0
2020-04-26T10:41:09.047Z
Have you tried this here? https://craftcms.stackexchange.com/questions/5125/get-entry-index
Max Strebel
<entries><pagination><count>
Struggling to get Entry index number so I can output "X of Total Entries"
# Struggling to get Entry index number so I can output "X of Total Entries"

(Asked by: username_0 on 2020-04-25)

I have a channel which has multiple entries in, I'm trying to output the current entry number, for example "1 out of 20 posts"
Currently this is what I am working with:
{% set total = craft.entries().section('spotlights').count() %}
{% set params = {section: 'spotlights', order: 'postDate desc', limit: null} %}
{% set entry_prev = entry.getPrev(params) %}
{% set entry_next = entry.getNext(params) %}


  
    
      {% if entry_prev %}
      
        Previous
      
      {% else %}
      
        Previous
      
      {% endif %}
      ENTRY NUMBER HERE of {{ total }}
      {% if entry_next %}
      
        Next
      
      {% else %}
      
        Next
      
      {% endif %}
    
  


I have my next and previous links working as well as the total entries in the section, I just can't work out how to get the current entry in the section. Any help would be appreciated.
I have tried a few different solutions on here but they all seem to be outdated.
Thanks.

**Tags:** entries, pagination, count
> **Comments:**
> **username_1**: Have you tried this here? https://craftcms.stackexchange.com/questions/5125/get-entry-index  

---

## 1 answers

### Answer by username_2 on 2020-04-29. Score: 1

I don't know if this is the best solution or if it will even work, but this would be my first try.
{% for spotlight in craft.entries().section('spotlights').all() %}
  {# Check to see if the title of the "spotlight" matches the current entry's title #}
  {% if spotlight.title == entry.title %}
    {{ loop.index }} of {{ total }}
  {% endif %}
{% endfor %}


---

