<p>Not sure I'm following 100%, but in Craft 2, a structured section has a "Nested Entries" text box in the "Entry URL Format" under a section's settings where you can dynamically access the URI of a parent element in a structure like so:</p>

<pre><code>{parent.uri}/{slug}
</code></pre>

<p>In Craft 3, under a section's Settings, that has moved to "Site Settings" and you just have the "Entry URL Format" text box.  You could do something similar like so:</p>

<pre><code>{parent.uri ?? ''}/{slug}
</code></pre>

<p>i.e. if there isn't a <code>parent.uri</code>, just use the <code>slug</code>, otherwise use prepend it.</p>

<p>You've got the full power of Twig in those text boxes, so you can adjust however you need.</p>

CC BY-SA 3.0
2017-11-21T09:23:25.890Z
Thanks Brad. However, I don't think I explained myself properly. Let's say I have 3 singles. `Our Company`, `What We Do` & `Projects`. I want to be able to place Pages (structure) to use those singles as a parent URI. So if I create 4 Pages for our company I need to prepend those with `/our-company/page-name` and if i create pages for What We Do – I need those to be prepended with `/what-we-do/page-name` etc... I'm just struggling with how to do this. Basically, I don't want to create 20+ singles for every page. I would rather use a pages structure with multiple entry types.
James N
CC BY-SA 3.0
2017-11-23T01:50:26.610Z
Why keep them as singles and not just make the "root" nodes in a structure section?  They can still have multiple entry types.
Brad Bell
CC BY-SA 3.0
2017-11-20T18:20:52.950Z
2017-11-20T18:20:52.950Z
Brad Bell
<p>This is probably very straight forward but unfortunately I can't seem to solve it.</p>

<p>We want to create a dynamic URI structure that allows us to easily create pages and link them with parent directories. So basically we have 4-5 pages that need to be added as "singles". Then we have around 40 pages (with around 3-4 total layouts) that we don't want to create a "Single" for each. So we've created a "Structure" called Pages and inside have 3-4 entry types. Grid list, plain template, big image and small image. We just want to create a bunch of "pages" and specify the parent URI.</p>

<p>For example, we have a single "Our Company", but then inside that parent we have multiple pages which we want to add in the "Pages" structure. But as our Entry URI for "pages" is set to {slug} this URL is www.website.com/slug. We need it to be www.website.com/our-company/slug. Of course we can simply update the Entry URI to have "our-company" but this won't work as all of the Entry URI's for all 40 pages will be our-company.</p>

<p>So basically, how can we manually or dynamically specify the segment 1 that page's URI should be?</p>

<url><routes><siteurl>
Dynamic Entry URI's for pages
# Dynamic Entry URI's for pages

(Asked by: username_0 on 2017-11-09)

This is probably very straight forward but unfortunately I can't seem to solve it.

We want to create a dynamic URI structure that allows us to easily create pages and link them with parent directories. So basically we have 4-5 pages that need to be added as "singles". Then we have around 40 pages (with around 3-4 total layouts) that we don't want to create a "Single" for each. So we've created a "Structure" called Pages and inside have 3-4 entry types. Grid list, plain template, big image and small image. We just want to create a bunch of "pages" and specify the parent URI.

For example, we have a single "Our Company", but then inside that parent we have multiple pages which we want to add in the "Pages" structure. But as our Entry URI for "pages" is set to {slug} this URL is www.website.com/slug. We need it to be www.website.com/our-company/slug. Of course we can simply update the Entry URI to have "our-company" but this won't work as all of the Entry URI's for all 40 pages will be our-company.

So basically, how can we manually or dynamically specify the segment 1 that page's URI should be?

**Tags:** url, routes, siteurl


---

## 1 answers

### Answer by username_1 on 2017-11-20. Score: 2

Not sure I'm following 100%, but in Craft 2, a structured section has a "Nested Entries" text box in the "Entry URL Format" under a section's settings where you can dynamically access the URI of a parent element in a structure like so:
{parent.uri}/{slug}

In Craft 3, under a section's Settings, that has moved to "Site Settings" and you just have the "Entry URL Format" text box.  You could do something similar like so:
{parent.uri ?? ''}/{slug}

i.e. if there isn't a parent.uri, just use the slug, otherwise use prepend it.
You've got the full power of Twig in those text boxes, so you can adjust however you need.

> **Comments:**
> **username_0**: Thanks Brad. However, I don't think I explained myself properly. Let's say I have 3 singles. `Our Company`, `What We Do` & `Projects`. I want to be able to place Pages (structure) to use those singles as a parent URI. So if I create 4 Pages for our company I need to prepend those with `/our-company/page-name` and if i create pages for What We Do – I need those to be prepended with `/what-we-do/page-name` etc... I'm just struggling with how to do this. Basically, I don't want to create 20+ singles for every page. I would rather use a pages structure with multiple entry types.  
> **username_1**: Why keep them as singles and not just make the "root" nodes in a structure section?  They can still have multiple entry types.  

---

