<p>If I understand your question, you want to combine a Single and a Structure into the same family of URL's, something like this:</p>

<p><code>/services</code> - <em>(Single)</em></p>

<p><code>/services/service-01</code> - <em>(Structure Entry)</em></p>

<p><code>/services/services-01/example-sub-service-01</code> - <em>(Structure Entry)</em></p>

<p><code>/services/services-01/example-sub-service-02</code> - <em>(Structure Entry)</em></p>

<p><code>/services/service-02</code> - <em>(Structure Entry)</em></p>

<p><code>/services/service-03</code> - <em>(Structure Entry)</em></p>

<hr>

<p>As you rightly said, you would create a <strong>Single</strong> for your Services homepage and set the URI to <code>services</code>.</p>

<p>You would then create a <strong>Structure</strong> called "Servcies", and set the URI to:</p>

<p><code>{parent.uri ? parent.uri: '/services'}/{slug}</code></p>

<p>This nice bit of Twig checks if <code>parent.uri</code> is defined, and outputs it if it is. Otherwise (if the entry is top level in the structure, it just outputs <code>/services/{slug}</code></p>

CC BY-SA 4.0
2019-02-04T15:49:58.657Z
2019-02-04T15:49:58.657Z
Jamie Wade
<p>I don't know if it's possible, but what I would like is to have a structure with 3 levels linked to a single entry that would act as the index. The problem is the examples I've seen are only with 1 level structures, so what they do is they set the single index URI as <code>services/</code> and then the structure URI as <code>services/{slug}</code>. This, for a level 3 structure, gives me <code>services/level3slug</code>. 
I want to display the parent URI on the level 3 entries, but if I do <code>services/{parent.uri}/{slug}</code>, I end up having a URI that is <code>services/level1slug/services/level2slug/services/level3slug</code>. When I would just have <code>services/level1slug/level2slug/level3slug</code>.</p>

<p>Is there a way of setting the single page as parent of the structure so I can just do <code>{parent.uri}/{slug}</code>?</p>

<craft3><structure><slug><entry-slug>
How to set index page as parent of a structure
# How to set index page as parent of a structure

(Asked by: username_0 on 2019-02-04)

I don't know if it's possible, but what I would like is to have a structure with 3 levels linked to a single entry that would act as the index. The problem is the examples I've seen are only with 1 level structures, so what they do is they set the single index URI as `services/` and then the structure URI as `services/{slug}`. This, for a level 3 structure, gives me `services/level3slug`.
I want to display the parent URI on the level 3 entries, but if I do `services/{parent.uri}/{slug}`, I end up having a URI that is `services/level1slug/services/level2slug/services/level3slug`. When I would just have `services/level1slug/level2slug/level3slug`.

Is there a way of setting the single page as parent of the structure so I can just do `{parent.uri}/{slug}`?

**Tags:** craft3, structure, slug, entry-slug


---

## 1 answers

### Answer by username_1 on 2019-02-04. Score: 2 | Accepted answer

If I understand your question, you want to combine a Single and a Structure into the same family of URL's, something like this:

`/services` - *(Single)*

`/services/service-01` - *(Structure Entry)*

`/services/services-01/example-sub-service-01` - *(Structure Entry)*

`/services/services-01/example-sub-service-02` - *(Structure Entry)*

`/services/service-02` - *(Structure Entry)*

`/services/service-03` - *(Structure Entry)*

---

As you rightly said, you would create a **Single** for your Services homepage and set the URI to `services`.

You would then create a **Structure** called "Servcies", and set the URI to:

`{parent.uri ? parent.uri: '/services'}/{slug}`

This nice bit of Twig checks if `parent.uri` is defined, and outputs it if it is. Otherwise (if the entry is top level in the structure, it just outputs `/services/{slug}`


---

