2

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}?

1 Answer 1

2

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}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.