<p>After chatting with The Honorable Brad Bell I learned that the sample tags in the field's label are showing some shorthand references to a few variables. (The <code>{slug}</code> reference for example.)</p>

<p>All I needed to do was use the <code>object</code> object to fully utilize twig tags/filters/etc. Here are a few ways to achieve what I was aiming for:</p>

<pre><code>{% set num = (object.id * 1234567) | number_format(0, null, '-') %}documents/{{ num }}
</code></pre>

<p>or slightly more concise code:</p>

<pre><code>documents/{{ (object.id * 1234567) | number_format(0, null, '-') }}
</code></pre>

<p>Also, thanks to carlsc for sharing the documentation on this feature. Reference: <a href="https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles" rel="nofollow">https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles</a>.</p>

<p>Happy Dynamic Titling and URLing.</p>

CC BY-SA 3.0
2016-02-08T14:39:43.090Z
It's documented in the "Sections and Entries" section of the Craft docs. https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles
carlcs
CC BY-SA 3.0
2016-02-08T14:40:56.330Z
@carlcs Thanks so much for the link! I couldn't find it when I went hunting. :)
Erik Reagan
CC BY-SA 3.0
2016-02-08T14:36:12.463Z
2016-02-08T14:43:07.427Z
2016-02-08T14:43:07.427Z
Erik Reagan
<p>I have an idea to create urls for entries that can't be guessed, but are automated without any extra effort from the content creator/editors. The intention is for the URL not require any authentication, but not be "guessable" just because you have another similar URL.</p>

<p>My thought was to use the <strong>Entry URL Format</strong> field to automate this. I tried the following but it didn't work as expected:</p>

<pre><code>documents/{ (id * 1234567) | number_format(0, null, '-') }
</code></pre>

<p>I assumed I could use any twig syntax here due to the description/label for the input field:</p>

<blockquote>
  <p>What the entry URLs should look like. You can include tags that output entry properties, such as <code>{slug}</code> or <code>{postDate|date("Y")}</code>.</p>
</blockquote>

<hr>

<p>So, is it possible to do what I'm trying? What's the correct twig syntax here?</p>

<templating><control-panel>
How do I properly use Twig syntax in dynamic title/URL fields?
# How do I properly use Twig syntax in dynamic title/URL fields?

(Asked by: username_0 on 2016-02-08)

I have an idea to create urls for entries that can't be guessed, but are automated without any extra effort from the content creator/editors. The intention is for the URL not require any authentication, but not be "guessable" just because you have another similar URL.
My thought was to use the Entry URL Format field to automate this. I tried the following but it didn't work as expected:
documents/{ (id * 1234567) | number_format(0, null, '-') }

I assumed I could use any twig syntax here due to the description/label for the input field:

What the entry URLs should look like. You can include tags that output entry properties, such as {slug} or {postDate|date("Y")}.


So, is it possible to do what I'm trying? What's the correct twig syntax here?

**Tags:** templating, control-panel


---

## 1 answers

### Answer by username_0 on 2016-02-08. Score: 6 | Accepted answer

After chatting with The Honorable Brad Bell I learned that the sample tags in the field's label are showing some shorthand references to a few variables. (The {slug} reference for example.)
All I needed to do was use the object object to fully utilize twig tags/filters/etc. Here are a few ways to achieve what I was aiming for:
{% set num = (object.id * 1234567) | number_format(0, null, '-') %}documents/{{ num }}

or slightly more concise code:
documents/{{ (object.id * 1234567) | number_format(0, null, '-') }}

Also, thanks to carlsc for sharing the documentation on this feature. Reference: https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles.
Happy Dynamic Titling and URLing.

> **Comments:**
> **username_1**: It's documented in the "Sections and Entries" section of the Craft docs. https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles  
> **username_0**: @username_1 Thanks so much for the link! I couldn't find it when I went hunting. :)  

---

