Answers.Body: <p>To get different URL Format for parent &amp; child pages, you need to go to the CP structure settings and edit the <strong>Entry URI Format</strong>. This is how your URI should look like:</p>
  
  <p><code>{% if level == 1 %}features/{slug}{% else %}{parent.slug}/{slug}{% endif %}</code></p>
  
  <p>For your templating question, if you want a different template for parents and children, you need an if statement in your template file for that structure. So in your CP structure settings, you will have one template file:  <code>features/feature_entry.twig</code> and inside that file you will have:</p>
  
  <pre><code>{% if entry.children|length %} 
  
     &lt;!-- If it has a child, it's a parent page --&gt;
     {% include 'features/_parent.twig' %}
  
  {% else %}&lt;!-- it's a child page --&gt;
  
     {% include 'features/_child.twig' %}
  
  {% endif %}
  </code></pre>
  
  <p>Just like that... You now have 2 different templates in 2 different .twig files.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-13T18:54:57.057Z
Answers.LastActivityDate: 2018-12-13T18:54:57.057Z
Answers.UserDisplayName: mateostabio
Body: <p>I need to create a <strong>features structure section</strong> for a website that will have parent features and child features. </p>
  
  <p><strong>Q1:</strong> How do I get different URL Format for parent &amp; child pages?</p>
  
  <ul>
  <li>I need the parent features here: <code>website.com/features/parent-feature</code></li>
  <li>And the Child features here <code>website.com/parent-feature/child-feature</code></li>
  </ul>
  
  <p><strong>Q2:</strong> How do I display the Parent &amp; Child in different templates? I want the parent features to look more dominant than the child features.</p>
  
Tags: <url><structure><sections><children><parents>
Title: How do I get different URL Format with parent/child structures & how do I display different templates?
ThreadText: # How do I get different URL Format with parent/child structures & how do I display different templates?
  
  (Asked by: username_0 on 2018-12-13)
  
  I need to create a **features structure section** for a website that will have parent features and child features.
  
  **Q1:** How do I get different URL Format for parent & child pages?
  
  * I need the parent features here: `website.com/features/parent-feature`
  * And the Child features here `website.com/parent-feature/child-feature`
  
  **Q2:** How do I display the Parent & Child in different templates? I want the parent features to look more dominant than the child features.
  
  **Tags:** url, structure, sections, children, parents
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-12-13. Score: 3 | Accepted answer
  
  To get different URL Format for parent & child pages, you need to go to the CP structure settings and edit the **Entry URI Format**. This is how your URI should look like:
  
  `{% if level == 1 %}features/{slug}{% else %}{parent.slug}/{slug}{% endif %}`
  
  For your templating question, if you want a different template for parents and children, you need an if statement in your template file for that structure. So in your CP structure settings, you will have one template file: `features/feature_entry.twig` and inside that file you will have:
  
  ```
  {% if entry.children|length %} 
  
     <!-- If it has a child, it's a parent page -->
     {% include 'features/_parent.twig' %}
  
  {% else %}<!-- it's a child page -->
  
     {% include 'features/_child.twig' %}
  
  {% endif %}
  
  ```
  
  Just like that... You now have 2 different templates in 2 different .twig files.
  
  
  ---
  
  