Answers.Body: <p>To pull off the same functionality in Craft 3, you could use something like this:</p>
  
  <pre><code>{entry.last().uri}/{parent.uri}/{slug}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-26T02:08:22.903Z
Answers.Text: Awesome, thanks Brad. Might be worth somehow including this in the CP field instructions for a structure or elsewhere in the craft doco as I would assume most people would want this format for a structure section. :)
Answers.UserDisplayName: Rich Hayler
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-28T07:23:55.130Z
Answers.Text: I ended up using the following: `{% if level == 1 %}{section.handle}{% else %}{parent.uri}{% endif %}/{slug}`
Answers.UserDisplayName: Rich Hayler
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-29T22:59:14.523Z
Answers.Text: the accepted answer turned out faulty on my craft 3 version. I ended up using `{parent.uri ?? 'top-level'}/{slug}` and solved my issue of duplicated segments while allowing for a fixed segment. The solution of Rich could be rewritten as `{parent.uri ?? section.handle}/{slug}` for readability purposes
Answers.UserDisplayName: 3xil3
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-04T04:14:09.240Z
Answers.Text: 3xil3 has the correct answer.
Answers.UserDisplayName: biko
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-22T15:22:30.430Z
Answers.Text: After trying all answers here and at the related question here: https://craftcms.stackexchange.com/q/26483/4060 , the only answer that seems to allow for a static, non-duplicated segment in the url is here: https://craftcms.stackexchange.com/a/26484/4060
Answers.UserDisplayName: Tchick
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-29T19:12:34.347Z
Answers.Text: This seems to be very complicated for what would ideally be a fairly mundane setting, coming back to Craft after a few months off I'm quite confused as to how to get this working at all!
Answers.UserDisplayName: James Greig
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-24T22:37:05.927Z
Answers.LastActivityDate: 2018-01-24T22:37:05.927Z
Answers.UserDisplayName: Brad Bell
Body: <p>In Craft 2.x you have the option of setting the top-level entries URL format for a structure section separately from nested entries i.e. <code>top-level/{slug}</code> and <code>{parent.uri}/{slug}</code></p>
  
  <p>But in Craft 3 the same URL format is applied for all entries within the structure section.</p>
  
  <p>This means if you use <code>top-level/{parent.uri}/{slug}</code> it works fine for a top-level entry but then nested entries have the first segment duplicated, e.g. top-level/top-level/some-parent/the-slug. How does one achieve the same level of URL formatting for structure entries in Craft 3?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-08-02T19:30:29.660Z
Comments.Text: This worked for me...
  https://craftcms.stackexchange.com/questions/26483/nested-entries-in-craft-3?newreg=dc9615a7c8bd4bac9fd5208438927108
Comments.UserDisplayName: user303199
Tags: <control-panel><craft3>
Title: {parent.uri}/{slug}
ThreadText: # {parent.uri}/{slug}
  
  (Asked by: username_0 on 2018-01-24)
  
  In Craft 2.x you have the option of setting the top-level entries URL format for a structure section separately from nested entries i.e. `top-level/{slug}` and `{parent.uri}/{slug}`
  
  But in Craft 3 the same URL format is applied for all entries within the structure section.
  
  This means if you use `top-level/{parent.uri}/{slug}` it works fine for a top-level entry but then nested entries have the first segment duplicated, e.g. top-level/top-level/some-parent/the-slug. How does one achieve the same level of URL formatting for structure entries in Craft 3?
  
  **Tags:** control-panel, craft3
  
  > **Comments:**
  > **username_1**: This worked for me... https://craftcms.stackexchange.com/questions/26483/nested-entries-in-craft-3?newreg=dc9615a7c8bd4bac9fd5208438927108  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-01-24. Score: 20 | Accepted answer
  
  To pull off the same functionality in Craft 3, you could use something like this:
  
  ```
  {entry.last().uri}/{parent.uri}/{slug}
  
  ```
  
  > **Comments:**
  > **username_0**: Awesome, thanks username_2. Might be worth somehow including this in the CP field instructions for a structure or elsewhere in the craft doco as I would assume most people would want this format for a structure section. :)  
  > **username_0**: I ended up using the following: `{% if level == 1 %}{section.handle}{% else %}{parent.uri}{% endif %}/{slug}`  
  > **username_3**: the accepted answer turned out faulty on my craft 3 version. I ended up using `{parent.uri ?? 'top-level'}/{slug}` and solved my issue of duplicated segments while allowing for a fixed segment. The solution of username_0 could be rewritten as `{parent.uri ?? section.handle}/{slug}` for readability purposes  
  > **username_4**: username_3 has the correct answer.  
  > **username_5**: After trying all answers here and at the related question here: https://craftcms.stackexchange.com/q/26483/4060 , the only answer that seems to allow for a static, non-duplicated segment in the url is here: https://craftcms.stackexchange.com/a/26484/4060  
  > **username_6**: This seems to be very complicated for what would ideally be a fairly mundane setting, coming back to Craft after a few months off I'm quite confused as to how to get this working at all!  
  
  ---
  
  