<p>If you're using a <code>for</code> loop to output the entries you can make use of <code>loop.index</code> which will give you the current iteration of the loop (starting from 1) and <code>loop.length</code> which is the total number of items in the <code>for</code> loop.</p>

<p>So something along the lines of:</p>

<pre><code>{% for entry in craft.entries.section('projects') %}
   {{ entry.title }} - {{ loop.index }} / {{ loop.length }}
{% endfor %}
</code></pre>

<p>Or, if you're on a single entry you can use <a href="https://craftcms.stackexchange.com/a/10546/4466">this answer</a> by Marion Newlevant.</p>

CC BY-SA 3.0
2016-07-19T16:45:26.927Z
I'm actually needing this in my `_entry.html` file, so it's out side of the the `for` loop. Any ideas on that?
Jesse Winton
CC BY-SA 3.0
2016-07-19T16:57:50.423Z
Just updated my answer with a link to another answer you may find helpful.
Luke Pearce
CC BY-SA 3.0
2016-07-19T10:06:46.727Z
2016-07-19T16:54:46.503Z
2017-04-13T12:51:00.303Z
Luke Pearce
<p>How can I get the number of a current entry in a structure? In other words, I'm getting the total number of entries like so:</p>

<pre><code>{% set count = craft.entries.section('projects').total() %}
&lt;h1&gt;{{ count }}&lt;/h1&gt;
</code></pre>

<p>But, I'd like to be able to output the number of the current entry in the hierarchy, i.e. something like 1/10. How do I do that?</p>

<templating><count>
Get the current structure entry's order
# Get the current structure entry's order

(Asked by: username_0 on 2016-07-18)

How can I get the number of a current entry in a structure? In other words, I'm getting the total number of entries like so:
{% set count = craft.entries.section('projects').total() %}
{{ count }}

But, I'd like to be able to output the number of the current entry in the hierarchy, i.e. something like 1/10. How do I do that?

**Tags:** templating, count

---

## 1 answers

### Answer by username_1 on 2016-07-19. Score: 2 | Accepted answer

If you're using a for loop to output the entries you can make use of loop.index which will give you the current iteration of the loop (starting from 1) and loop.length which is the total number of items in the for loop.
So something along the lines of:
{% for entry in craft.entries.section('projects') %}
   {{ entry.title }} - {{ loop.index }} / {{ loop.length }}
{% endfor %}

Or, if you're on a single entry you can use this answer by Marion Newlevant.

> **Comments:**
> **username_0**: I'm actually needing this in my `_entry.html` file, so it's out side of the the `for` loop. Any ideas on that?  
> **username_1**: Just updated my answer with a link to another answer you may find helpful.  

---

