<p>I resolved the issue by using the following code for my title format</p>

<pre><code>{% if object.parent %}{ postDate|date('M') }{% else %}{ postDate|date('Y') }{% endif %}
</code></pre>

CC BY-SA 3.0
2016-10-25T06:56:19.153Z
2016-10-25T06:56:19.153Z
Rich Hayler
<p>I'm trying to set a title for a STRUCTURE entry dynamically based on the structure level within the section hierarchy.</p>

<pre><code>{% if entry.level('not 1') %}{ postDate|date('M') }{% else %}{ postDate|date('Y') }{% endif %}
</code></pre>

<p>I've tried using the above for the title format of my entry type but it only appears to work for setting YYYY for the parent entry and doesn't add the month for child entries.</p>

<templating><entries>
Setting structure section entry titles dynamically based on the entry level
# Setting structure section entry titles dynamically based on the entry level

(Asked by: username_0 on 2016-10-25)

I'm trying to set a title for a STRUCTURE entry dynamically based on the structure level within the section hierarchy.
{% if entry.level('not 1') %}{ postDate|date('M') }{% else %}{ postDate|date('Y') }{% endif %}

I've tried using the above for the title format of my entry type but it only appears to work for setting YYYY for the parent entry and doesn't add the month for child entries.

**Tags:** templating, entries

---

## 1 answers

### Answer by username_0 on 2016-10-25. Score: 2

I resolved the issue by using the following code for my title format
{% if object.parent %}{ postDate|date('M') }{% else %}{ postDate|date('Y') }{% endif %}


---

