Answers.Body: <p>Since you're using pagination, you can calculate the offset using the current page and number of items per page.</p>
  <pre class="lang-twig prettyprint-override"><code>{% set limit = 10 %}
  {% set archiveQuery = craft.entries()
      .section('blog')
      .limit(limit)
  %}
  
  {% paginate archiveQuery as pageInfo, posts %}
  
  {% set offset = (pageInfo.currentPage - 1) * limit %}
  
  {% for post in posts %}
      Entry {{ offset + loop.index }} of {{ pageInfo.total }}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-07-09T17:03:57.870Z
Answers.Text: Brilliant ! Thx a lot !
Answers.UserDisplayName: Artur Potosyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-07-09T08:35:45.607Z
Answers.LastActivityDate: 2024-07-09T08:35:45.607Z
Answers.UserDisplayName: MoritzLost
Answers.Body: <p>I’m not sure if this is what you’re asking for, but you can number fetched entries inside a <code>for</code> loop in Twig using the current iteration of the loop (<code>loop.index</code>).</p>
  <pre><code>{% set entries = craft.entries.all() %}
  {% for entry in entries %}
      Entry #{{ loop.index }} of {{ entries|length }}
  {% endfor %}
  </code></pre>
  <p>To make this work when paginating entries, you can add the current page’s first entry number (<code>pageInfo.first</code>) to the zero-indexed iteration of the loop (<code>loop.index0</code>).</p>
  <pre><code>{% set entryQuery = craft.entries.limit(10) %}
  {% paginate entryQuery as pageInfo, entries %}
  {% for entry in entries %}
      Entry #{{ pageInfo.first + loop.index0 }} of {{ pageInfo.total }}
  {% endfor %}
  </code></pre>
  <p>References:<br />
  <a href="https://craftcms.com/docs/5.x/development/element-queries.html#navigating-pages" rel="nofollow noreferrer">https://craftcms.com/docs/5.x/development/element-queries.html#navigating-pages</a><br />
  <a href="https://twig.symfony.com/doc/3.x/tags/for.html#the-loop-variable" rel="nofollow noreferrer">https://twig.symfony.com/doc/3.x/tags/for.html#the-loop-variable</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-07-08T10:07:05.100Z
Answers.Text: ok, thx, will try and let you know
Answers.UserDisplayName: Artur Potosyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-07-08T19:48:54.233Z
Answers.Text: It works, but, for pagination state, for every next page, it starts from 1 of total, rather than continuing from the previous page.
Answers.UserDisplayName: Artur Potosyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-07-09T17:24:07.863Z
Answers.Text: You didn’t mention that in your question, but I’ve added a second code sample to my answer for the case when you’re paginating entries.
Answers.UserDisplayName: Ben Croker
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-07-08T09:21:39.950Z
Answers.LastActivityDate: 2024-07-09T17:23:24.443Z
Answers.LastEditDate: 2024-07-09T17:23:24.443Z
Answers.UserDisplayName: Ben Croker
Body: <p>is there any way to add ascending numbers to entries archive, i.e. Entry #1 of 100, Entry #2 of 100, #3 of 100 etc. Thanks in advance.</p>
  
Tags: <number>
Title: Numbering of entries (1, 2, 3 ...)
ThreadText: # Numbering of entries (1, 2, 3 ...)
  
  (Asked by: username_0 on 2024-07-08)
  
  is there any way to add ascending numbers to entries archive, i.e. Entry #1 of 100, Entry #2 of 100, #3 of 100 etc. Thanks in advance.
  
  **Tags:** number
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2024-07-09. Score: 1
  
  Since you're using pagination, you can calculate the offset using the current page and number of items per page.
  
  ```twig
  {% set limit = 10 %}
  {% set archiveQuery = craft.entries()
      .section('blog')
      .limit(limit)
  %}
  
  {% paginate archiveQuery as pageInfo, posts %}
  
  {% set offset = (pageInfo.currentPage - 1) * limit %}
  
  {% for post in posts %}
      Entry {{ offset + loop.index }} of {{ pageInfo.total }}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Brilliant ! Thx a lot !  
  
  ---
  
  ### Answer by username_2 on 2024-07-08. Score: 1
  
  I’m not sure if this is what you’re asking for, but you can number fetched entries inside a `for` loop in Twig using the current iteration of the loop (`loop.index`).
  
  ```
  {% set entries = craft.entries.all() %}
  {% for entry in entries %}
      Entry #{{ loop.index }} of {{ entries|length }}
  {% endfor %}
  
  ```
  
  To make this work when paginating entries, you can add the current page’s first entry number (`pageInfo.first`) to the zero-indexed iteration of the loop (`loop.index0`).
  
  ```
  {% set entryQuery = craft.entries.limit(10) %}
  {% paginate entryQuery as pageInfo, entries %}
  {% for entry in entries %}
      Entry #{{ pageInfo.first + loop.index0 }} of {{ pageInfo.total }}
  {% endfor %}
  
  ```
  
  References:  
  <https://craftcms.com/docs/5.x/development/element-queries.html#navigating-pages>  
  <https://twig.symfony.com/doc/3.x/tags/for.html#the-loop-variable>
  
  > **Comments:**
  > **username_0**: ok, thx, will try and let you know  
  > **username_0**: It works, but, for pagination state, for every next page, it starts from 1 of total, rather than continuing from the previous page.  
  > **username_2**: You didn’t mention that in your question, but I’ve added a second code sample to my answer for the case when you’re paginating entries.  
  
  ---
  
  