Answers.Body: <p>The only way to do this is to create multiple <a href="https://docs.craftcms.com/v3/sections-and-entries.html#entry-types" rel="nofollow noreferrer">entry types</a> for your structure section.</p>
  <p>Each entry type has its own field layout (can have different fields from the other entry types in that section).</p>
  <p>Sadly, it's not possible to restrict entry types to a particular level in a structure – i.e. if you create &quot;Landing Page&quot; and &quot;Sub Page&quot; entry types, there's no way in Craft to make sure that the level 1 and level 2 entries actually use those entry types, according to their level. So, ideally you should a) make sure whoever edits the content in that section makes sure that they should be careful to use particular entry types for particular structure levels, and b) design and create templates that are flexible enough to work even if, for example, somebody publishes a &quot;Sub Page&quot; entry at level 1.</p>
  <p>Most likely, you should change your current templating setup with <a href="https://craftcms.com/knowledge-base/entry-type-templates#:%7E:text=Our%20section%20will%20have%20three,as%20the%20main%20section%20template." rel="nofollow noreferrer">something like this</a>, if you go down this route.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-27T22:37:31.097Z
Answers.Text: Thanks for the info. It's unfortunate templates can't be selected on a per entry basis rather than by structure.  I'll have to do as you suggested - create multiple entry types.
Answers.UserDisplayName: Jake1293
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-30T23:44:22.690Z
Answers.Text: I'll check it out, thank you =)
Answers.UserDisplayName: Jake1293
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-27T17:11:19.543Z
Answers.LastActivityDate: 2020-06-27T17:11:19.543Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I set up a structure for pages that looks like this:</p>
  <pre><code>- All Services
    - Service 1
      - Service 1 subpage a
      - Service 1 subpage b
    - Service 2
      - Service 2 subpage a
      - Service 2 subpage b
  </code></pre>
  <p>I followed the accepted answer <a href="https://craftcms.stackexchange.com/questions/17988/how-to-manage-different-templates-for-a-structure/">to this question</a> to set up different templates within that structure, so now the level 2 pages (i.e. Service 1 and 2) use a different template than the level 3 subpages (i.e. a and b).</p>
  <p>These templates have different elements, so now I want to show different fields/field layouts when I edit the page entries. For example, if I'm editing a level 2 page, it should show fields for the title, a rich text field, an image upload field, and a few other fields I've created, but if I'm editing a level 3 page, it should only show a title and rich text field.</p>
  <p>Is it possible to do this? If not, what's the best way to handle this type of thing in Craft? I'm trying to avoid creating one structure for level 2 pages, and another structure for level 3 pages, because I'm not sure how to preserve the hierarchical relationship between level 3 and level 2 pages if I do that.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-30T18:32:05.737Z
Comments.Text: This plugin might be of interest: https://plugins.craftcms.com/level-entry-types
Comments.UserDisplayName: Dalton Rooney
Tags: <templating><field><structure>
Title: Showing different field layouts for entries within the same structure
ThreadText: # Showing different field layouts for entries within the same structure
  
  (Asked by: username_0 on 2020-06-27)
  
  I set up a structure for pages that looks like this:
  
  ```
  - All Services
    - Service 1
      - Service 1 subpage a
      - Service 1 subpage b
    - Service 2
      - Service 2 subpage a
      - Service 2 subpage b
  
  ```
  
  I followed the accepted answer [to this question](https://craftcms.stackexchange.com/questions/17988/how-to-manage-different-templates-for-a-structure/) to set up different templates within that structure, so now the level 2 pages (i.e. Service 1 and 2) use a different template than the level 3 subpages (i.e. a and b).
  
  These templates have different elements, so now I want to show different fields/field layouts when I edit the page entries. For example, if I'm editing a level 2 page, it should show fields for the title, a rich text field, an image upload field, and a few other fields I've created, but if I'm editing a level 3 page, it should only show a title and rich text field.
  
  Is it possible to do this? If not, what's the best way to handle this type of thing in Craft? I'm trying to avoid creating one structure for level 2 pages, and another structure for level 3 pages, because I'm not sure how to preserve the hierarchical relationship between level 3 and level 2 pages if I do that.
  
  **Tags:** templating, field, structure
  
  > **Comments:**
  > **username_1**: This plugin might be of interest: https://plugins.craftcms.com/level-entry-types  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-06-27. Score: 2 | Accepted answer
  
  The only way to do this is to create multiple [entry types](https://docs.craftcms.com/v3/sections-and-entries.html#entry-types) for your structure section.
  
  Each entry type has its own field layout (can have different fields from the other entry types in that section).
  
  Sadly, it's not possible to restrict entry types to a particular level in a structure – i.e. if you create "Landing Page" and "Sub Page" entry types, there's no way in Craft to make sure that the level 1 and level 2 entries actually use those entry types, according to their level. So, ideally you should a) make sure whoever edits the content in that section makes sure that they should be careful to use particular entry types for particular structure levels, and b) design and create templates that are flexible enough to work even if, for example, somebody publishes a "Sub Page" entry at level 1.
  
  Most likely, you should change your current templating setup with [something like this](https://craftcms.com/knowledge-base/entry-type-templates#:%7E:text=Our%20section%20will%20have%20three,as%20the%20main%20section%20template.), if you go down this route.
  
  > **Comments:**
  > **username_0**: Thanks for the info. It's unfortunate templates can't be selected on a per entry basis rather than by structure.  I'll have to do as you suggested - create multiple entry types.  
  > **username_0**: I'll check it out, thank you =)  
  
  ---
  
  