7

I have a nested Structure with 3 layers like so:

  • Home
  • Services
    • Service A
      • Sub Service A
      • Sub Service B
    • Service B
  • About Us
  • Contact

Now I would like the nesting to be reflected in the URL like so:

http://example.com/services/service-a/sub-service-a

I used {parent.slug}/{slug} as the URL Format and this is working for two but not three layers.

How would the correct format look like?

1 Answer 1

13

Set the Nested Entries URL format to:

{parent.uri}/{slug}
7
  • As a side question: I lost this piece of code in the field while setting the structure to one level, then I could find it nowhere in the documentation of craft or twig. There is no ordered overview of this kind of variables?
    – noregt
    Commented Mar 17, 2015 at 11:13
  • I don't quite understand your question, could you please expand on it a bit?
    – Ben Croker
    Commented Mar 17, 2015 at 19:43
  • To put it simple: where can I find this {parent.uri} in the docs?
    – noregt
    Commented Mar 18, 2015 at 7:29
  • I don't see it in the docs, but the field itself contains instructions saying that "you can include tags that output entry properties", and parent is documented here: buildwithcraft.com/docs/templating/entrymodel#parent
    – Ben Croker
    Commented Mar 19, 2015 at 7:51
  • Thanks Ben, that's give me an idea about how the docs are setup :-)
    – noregt
    Commented Mar 19, 2015 at 11:21

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.