<p>If your structure only has one level, you can use a title format like this:</p>

<p><code>Number {{ craft.entries.order('lft desc').positionedBefore(object).total()+1 }} published in {postDate|date('F')} {postDate|date('Y')}</code></p>

<p>This works when you create new entries, they'll get their current position in the title. </p>

<p>The problem is that this number won't get updated if you sort the stucture, since you'd need to resave all entries affected by the move, to update their title and slug. You can do this by creating a custom plugin (or module, if you're using Craft 3), listen to the appropriate events (for instance <code>Element.EVENT_AFTER_MOVE_IN_STRUCTURE</code> in Craft 3), and resave all entries. This could be a quite resource intensive operation if you have a lot of entries.</p>

<p>You could also get the number in Twig with the same code:</p>

<p><code>{{ craft.entries({ order: 'lft desc', positionedBefore: entry }).total() + 1 }}</code></p>

<p>This number will always be the updated number in the position, since the query is executed at runtime, instead of when an entry is saved. If you want to show this number to the enduser, I'd recommend this approach. </p>

<p>If you want to show the number in the control panel, I'd recommend looking into the ability to add custom columns to Craft's element indexes instead of having it in the title. </p>

<p>Maybe if you provide more information on the use-case, we can provide even more insight into possible solutions.</p>

CC BY-SA 3.0
2018-04-08T12:50:48.320Z
2018-04-08T12:50:48.320Z
André Elvan
<p>You can include the level </p>

<pre><code>number {level} published in {postDate|date('F')} {postDate|date('Y')}
</code></pre>

CC BY-SA 3.0
2018-04-06T08:22:40.487Z
Thank you Robin, but that will give me "1". I am looking for the number in a sequence. Entry 1, entry 2, entry 3, etc..
Nutmeg
CC BY-SA 3.0
2018-04-06T07:33:05.147Z
2018-04-06T07:33:05.147Z
Robin Schambach
<p>Is it possible to include the entry position (Structure) via the Entry Type Title Format?</p>

<p>This is the current format:</p>

<pre><code>published in {postDate|date('F')} {postDate|date('Y')}
</code></pre>

<p>which renders: published-in-april-2018</p>

<p><strong>This is what we need it to render:</strong></p>

<pre><code>number-3-published-in-april-2018
</code></pre>

<p>I could create an actual Number field called “numberTitle”, attach it to the Entry Type, and set the Entry Type’s title to be dynamically generated using the template “{numberTitle}”, but why does this need to be done manually?
You would think that the entries in a Section have a natural order in sequence or maybe they don't?</p>

<p>If the EntryVersion Model cannot deliver could Twig offer a solution?</p>

CC BY-SA 3.0
2018-04-08T12:25:20.030Z
Craft 2 or 3? And do you have multiple levels in your structure, or just one?
André Elvan
CC BY-SA 3.0
2018-04-08T21:19:39.597Z
Craft 3, single levels. This is for archival purpose of monthly newsletters, which are numbered, rather than titled. It seemed logical to have Craft do the counting - but to show this in the control panel was the great unknown. Enfin, this will work as re-structuring won't change the sequence of the entry. Thank you! PS: depreciated function/elements updated....
Nutmeg
<url><structure>
Structure entry position in url
# Structure entry position in url

(Asked by: username_0 on 2018-04-05)

Is it possible to include the entry position (Structure) via the Entry Type Title Format?
This is the current format:
published in {postDate|date('F')} {postDate|date('Y')}

which renders: published-in-april-2018
This is what we need it to render:
number-3-published-in-april-2018

I could create an actual Number field called “numberTitle”, attach it to the Entry Type, and set the Entry Type’s title to be dynamically generated using the template “{numberTitle}”, but why does this need to be done manually?
You would think that the entries in a Section have a natural order in sequence or maybe they don't?
If the EntryVersion Model cannot deliver could Twig offer a solution?

**Tags:** url, structure

> **Comments:**
> **username_1**: Craft 2 or 3? And do you have multiple levels in your structure, or just one?  
> **username_0**: Craft 3, single levels. This is for archival purpose of monthly newsletters, which are numbered, rather than titled. It seemed logical to have Craft do the counting - but to show this in the control panel was the great unknown. Enfin, this will work as re-structuring won't change the sequence of the entry. Thank you! PS: depreciated function/elements updated....  

---

## 2 answers

### Answer by username_1 on 2018-04-08. Score: 0 | Accepted answer

If your structure only has one level, you can use a title format like this:

`Number {{ craft.entries.order('lft desc').positionedBefore(object).total()+1 }} published in {postDate|date('F')} {postDate|date('Y')}`

This works when you create new entries, they'll get their current position in the title.

The problem is that this number won't get updated if you sort the stucture, since you'd need to resave all entries affected by the move, to update their title and slug. You can do this by creating a custom plugin (or module, if you're using Craft 3), listen to the appropriate events (for instance `Element.EVENT_AFTER_MOVE_IN_STRUCTURE` in Craft 3), and resave all entries. This could be a quite resource intensive operation if you have a lot of entries.

You could also get the number in Twig with the same code:

`{{ craft.entries({ order: 'lft desc', positionedBefore: entry }).total() + 1 }}`

This number will always be the updated number in the position, since the query is executed at runtime, instead of when an entry is saved. If you want to show this number to the enduser, I'd recommend this approach.

If you want to show the number in the control panel, I'd recommend looking into the ability to add custom columns to Craft's element indexes instead of having it in the title.

Maybe if you provide more information on the use-case, we can provide even more insight into possible solutions.


---

### Answer by username_2 on 2018-04-06. Score: 0

You can include the level 
number {level} published in {postDate|date('F')} {postDate|date('Y')}

> **Comments:**
> **username_0**: Thank you Robin, but that will give me "1". I am looking for the number in a sequence. Entry 1, entry 2, entry 3, etc..  

---

