Answers.Body: <p>Pretty sure that the <code>ResaveElements</code> task just hadn't run yet - my queue was stuck. Once I cleared the stuck items, the issue resolved on its own!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T21:51:20.963Z
Answers.LastActivityDate: 2018-04-14T21:51:20.963Z
Answers.UserDisplayName: Katie Fritz
Answers.Body: <p>Please take a look into your section. In Craft 2 there are two fields: Uri format parent and URI format child. You probably included the parent slug into the child input</p>
  
  <p>Additional note: it's not a good way to rebuild your links manually. You should always use the <code>getUrl()</code> function unless you have a really good reason for it </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T21:14:20.203Z
Answers.Text: Thanks for the quick response, Robin! Could you explain it more for me, or maybe in different words?
  
  - I'm using Craft 3, not Craft 2.
  - What do you mean by URI format parent and URI format child? Is that somewhere in the docs you could point me to?
  - If I'm putting the slug in the wrong, place, what is the right place?
  
  Thanks in advance!
Answers.UserDisplayName: Katie Fritz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T21:17:09.767Z
Answers.Text: You have two inputs in your section settings. One contains the url format for your first level entries (the parent) one input is for the child url format. When you say your child url format contains the parent slug that's usually because your input field looks like `{parent.slug}{slug}` or something like that. Remove the `{parent.slug}` part and it should be fine. Because you said "the entry uri format is `about/{slug}`" you looked only at the first level uri, not at the field next to it
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T21:22:30.857Z
Answers.Text: Thanks! I just added a screenshot of my section settings to my original post. I only see one option for adding a URL format. Is there another place I should be looking?
Answers.UserDisplayName: Katie Fritz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T21:25:34.827Z
Answers.Text: Ah no, I just didn't realize it was about Craft 3. Craft 3 removed the 2nd field and combined them into one. When you take a look at your entry list in your cp and include the `URL` column to the table, is the format correct?
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T21:31:01.767Z
Answers.Text: So, weird things happening. I've set the Entry URI format to just be {{ slug }}, and removed the conditional logic/redirects from my template for testing. When I create a new page in this section (level 1), the URL is just mysite.com/slug. For my old pages, it's mysite.com/about/slug.
Answers.UserDisplayName: Katie Fritz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T21:33:11.083Z
Answers.Text: And if I create test-child-page, it's at mysite.com/test-child-page no matter what its parent is...
Answers.UserDisplayName: Katie Fritz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T21:36:49.870Z
Answers.Text: Seems like your `ResaveElements` task did not run or you have to many entries in your section so it takes a little bit longer to loop through them. When you just insert `{slug} ` that's the expected behavior. I thought you wanted to remove the parents slug from the url
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T21:40:59.730Z
Answers.Text: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/76037/discussion-between-katie-fritz-and-robin-schambach).
Answers.UserDisplayName: Katie Fritz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-14T20:59:09.787Z
Answers.LastActivityDate: 2018-04-14T20:59:09.787Z
Answers.UserDisplayName: Robin Schambach
Body: <h2>Basic info</h2>
  
  <ul>
  <li>I have a structure with a handle <code>about</code>. </li>
  <li>The Entry URI format is <code>about/{slug}</code>. EDIT: also tried it with just <code>{{ slug }}</code></li>
  <li>I created a child page called "Privacy Policy" with the slug <code>privacy-policy</code>. It has a parent of the page "About SAFS" (slug <code>about-safs</code>). </li>
  <li><strong>I can only access the page at <code>mysite.com/about/about-safsprivacy-policy</code>. If I go to <code>mysite.com/about/privacy-policy</code>, I get a 404.</strong> </li>
  <li>If I include <code>{{ entry.slug }}</code> in the template, it prints <code>privacy-policy</code>.</li>
  </ul>
  
  <p>Edit: This is my Settings > Sections > About after changing slug to just <code>{ slug }</code>
  <a href="https://i.sstatic.net/0IcAl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0IcAl.png" alt="enter image description here"></a></p>
  
  <h2>My question</h2>
  
  <p>Why is the parent's slug being inserted into the URI, and how do I change that?</p>
  
  <hr>
  
  <h2>Possibly relevant info</h2>
  
  <p>All the top-level pages in the About structure display on a single page, using this template for the entries:</p>
  
  <pre><code>{% if entry.level == 1 %}
    {% redirect siteUrl|trim ~ 'about#' ~ entry.slug %}
  {% else %}
  
    {# normal template #}
  </code></pre>
  
  <p>For the About index template, I include:</p>
  
  <pre><code>{% set link = siteUrl ~ "/about" %}
  </code></pre>
  
  <p>EDIT: I also tried removing the redirect from the template, and I'm getting the same routing issue for the <code>privacy-policy</code> entry.</p>
  
Tags: <templating><craft3><structure><routing>
Title: Why is the parent slug showing up in the child slug in a structure?
ThreadText: # Why is the parent slug showing up in the child slug in a structure?
  
  (Asked by: username_0 on 2018-04-14)
  
  ## Basic info
  
  * I have a structure with a handle `about`.
  * The Entry URI format is `about/{slug}`. EDIT: also tried it with just `{{ slug }}`
  * I created a child page called "Privacy Policy" with the slug `privacy-policy`. It has a parent of the page "About SAFS" (slug `about-safs`).
  * **I can only access the page at `mysite.com/about/about-safsprivacy-policy`. If I go to `mysite.com/about/privacy-policy`, I get a 404.**
  * If I include `{{ entry.slug }}` in the template, it prints `privacy-policy`.
  
  Edit: This is my Settings > Sections > About after changing slug to just `{ slug }`
  [![enter image description here](https://i.sstatic.net/0IcAl.png)](https://i.sstatic.net/0IcAl.png)
  
  ## My question
  
  Why is the parent's slug being inserted into the URI, and how do I change that?
  
  ---
  
  ## Possibly relevant info
  
  All the top-level pages in the About structure display on a single page, using this template for the entries:
  
  ```
  {% if entry.level == 1 %}
    {% redirect siteUrl|trim ~ 'about#' ~ entry.slug %}
  {% else %}
  
    {# normal template #}
  
  ```
  
  For the About index template, I include:
  
  ```
  {% set link = siteUrl ~ "/about" %}
  
  ```
  
  EDIT: I also tried removing the redirect from the template, and I'm getting the same routing issue for the `privacy-policy` entry.
  
  **Tags:** templating, craft3, structure, routing
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-04-14. Score: 3 | Accepted answer
  
  Pretty sure that the `ResaveElements` task just hadn't run yet - my queue was stuck. Once I cleared the stuck items, the issue resolved on its own!
  
  
  ---
  
  ### Answer by username_1 on 2018-04-14. Score: 1
  
  Please take a look into your section. In Craft 2 there are two fields: Uri format parent and URI format child. You probably included the parent slug into the child input
  
  Additional note: it's not a good way to rebuild your links manually. You should always use the `getUrl()` function unless you have a really good reason for it
  
  > **Comments:**
  > **username_0**: Thanks for the quick response, username_1! Could you explain it more for me, or maybe in different words?  - I'm using Craft 3, not Craft 2. - What do you mean by URI format parent and URI format child? Is that somewhere in the docs you could point me to? - If I'm putting the slug in the wrong, place, what is the right place?  Thanks in advance!  
  > **username_1**: You have two inputs in your section settings. One contains the url format for your first level entries (the parent) one input is for the child url format. When you say your child url format contains the parent slug that's usually because your input field looks like `{parent.slug}{slug}` or something like that. Remove the `{parent.slug}` part and it should be fine. Because you said "the entry uri format is `about/{slug}`" you looked only at the first level uri, not at the field next to it  
  > **username_0**: Thanks! I just added a screenshot of my section settings to my original post. I only see one option for adding a URL format. Is there another place I should be looking?  
  > **username_1**: Ah no, I just didn't realize it was about Craft 3. Craft 3 removed the 2nd field and combined them into one. When you take a look at your entry list in your cp and include the `URL` column to the table, is the format correct?  
  > **username_0**: So, weird things happening. I've set the Entry URI format to just be {{ slug }}, and removed the conditional logic/redirects from my template for testing. When I create a new page in this section (level 1), the URL is just mysite.com/slug. For my old pages, it's mysite.com/about/slug.  
  > **username_0**: And if I create test-child-page, it's at mysite.com/test-child-page no matter what its parent is...  
  > **username_1**: Seems like your `ResaveElements` task did not run or you have to many entries in your section so it takes a little bit longer to loop through them. When you just insert `{slug} ` that's the expected behavior. I thought you wanted to remove the parents slug from the url  
  > **username_0**: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/76037/discussion-between-username_0-username_0-and-username_1-username_1).  
  
  ---
  
  