Answers.Body: <p>First off, for communication reasons, let's refer to the "Structure" as a section, not a page type. Anytime you create either a Channel or Structure section, you have the ability to create what are called "entry types".  You will see them listed on the far right of Settings > Sections in Craft.</p>
  
  <h3>The Solution in a nutshell</h3>
  
  <p>In your case, you will want to create a new <strong>Entry Type</strong> in your Structure to accommodate this custom deviant page, which will allow you to choose different fields for that type and its own template for its own custom code.</p>
  
  <hr>
  
  <h3>What is an "Entry Type"?</h3>
  
  <p>Ok, so what is an Entry Type?  You know when you go to post a status on facebook and you have the ability to just write text, or you could choose to upload an image, or you might want to check in?  All of these different types of status posts may share the same fields (like the text field to post your status), but some have additional or completely different fields (like uploading an image), but they are all "<em>Status Posts</em>" to Facebook, just different types of status posts.  This is a <em>very</em> over-simplified example, I know, but it's kind of what Entry Types in Craft are for a Channel or Structure.  They're like an inherent built-in category group that allow you to design different custom field layouts for different types of entries within that one Channel or Structure.</p>
  
  <p>So if you make a Structure called "Generic Pages", you could then create different entry types in that Structure like "Single Column", "With Sidebar", "Top Banner", etc, and they can all get their own custom field setup with their own templates.  Or you could just use one template for them all. I've created Events channels before using things like "Event", "Concert", "Party", "Meetup", etc as the different types.  When I create a new entry in the "Events" channel, I then choose which <em>type</em> of event it is, and by doing so, I'm able to customize which type gets which fields.  They all have a "Start Date" field, but maybe the "Concert" type has a "Door Price" field, whereas "Meetup" doesn't. This way you don't have a confusing "Door Price" field for "Meetup" events that shouldn't be or don't need to be filled in.</p>
  
  <hr>
  
  <h3>Templating</h3>
  
  <p>Ok, so how do we handle this in the templates? When you create the section in Craft, you'll point to whatever template you want for the section as a whole (let's say <code>/generic-pages/_entry</code> for example).  In that <code>_entry</code> template, add just this line:</p>
  
  <p><code>{% include "generic-pages/" ~ entry.type %}</code></p>
  
  <p>Then inside the <code>/generic-pages/</code> directory, you create a different template for each entry type you made in Craft.  Name that template exactly how the handle looks like.  So if you made a "Single Column" entry type and the handle is <code>singleColumn</code>, then "singleColumn.html" is the name of your template.  Customize that template all you want.</p>
  
  <p>Here's a proper article on Craft's site talking about this method:
  <a href="https://craftcms.com/support/entry-type-templates" rel="nofollow noreferrer">https://craftcms.com/support/entry-type-templates</a></p>
  
  <p>Even if you're using one template for all entries in this Structure/Channel regardless of entry type, you can still be selective with how you grab your entries like:</p>
  
  <p><code>{% set entries = craft.entries.section('genericPages').type('singleColumn') %}</code></p>
  
  <p>Or be conditional based on type:</p>
  
  <pre><code>{% if entry.type == 'concert' %}
      // do something
  {% endif %}
  </code></pre>
  
  <hr>
  
  <p>Read more about Entry Types in the Craft Docs: <a href="https://craftcms.com/docs/sections-and-entries#entry-types" rel="nofollow noreferrer">https://craftcms.com/docs/sections-and-entries#entry-types</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-15T05:56:15.523Z
Answers.Text: Thank you Ryan, I've used this detailed response to build a solution with a custom code block entry type as a workaround. What I originally wanted was to be able to take content from a Singles entry or even static HTML and replace the contents of a structured entry that is needed to maintain URL pattern.
Answers.UserDisplayName: Bill Rafferty
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-15T15:31:00.350Z
Answers.Text: Ah no problem.  So it sounds like you added a Entries relation field to pull content in from the single?  Anyway, glad it helped and hope this explanation helps others down the road!
Answers.UserDisplayName: Ryan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T19:53:03.160Z
Answers.LastActivityDate: 2017-09-13T19:53:03.160Z
Answers.UserDisplayName: Ryan
Body: <p>I have a site that I've created a 'Generic Page' type for that is a Structured type with URL Format of {slug}.</p>
  
  <p>This is great for the client as they can create an entry for 'toplevelpage' and then children e.g. 'toplevelpage/firstchild' and the URL structure works as desired.</p>
  
  <p>In a few places, they have custom pages that are not Structured type 'Generic Page' entries but need to sit in that same site URL structure. For example, toplevelpage/fistchild is a 'Generic Page' but they need a toplevelpage/customchild but the parent URL is now owned by the Structured type.</p>
  
  <p>Can I get Craft or Twig to look for Singles or even Twig magic at that level and then just have a stub structured Generic Page that has is content overwritten?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-13T17:20:03.450Z
Comments.Text: If I'm following you correctly, then sounds like a case for a dynamic route? https://craftcms.com/docs/routing#dynamic-routes
Comments.UserDisplayName: Brad Bell
Tags: <url><structure>
Title: Replacing content a specific URL/page already reserved in Structured Data Entries
ThreadText: # Replacing content a specific URL/page already reserved in Structured Data Entries
  
  (Asked by: username_0 on 2017-09-13)
  
  I have a site that I've created a 'Generic Page' type for that is a Structured type with URL Format of {slug}.
  
  This is great for the client as they can create an entry for 'toplevelpage' and then children e.g. 'toplevelpage/firstchild' and the URL structure works as desired.
  
  In a few places, they have custom pages that are not Structured type 'Generic Page' entries but need to sit in that same site URL structure. For example, toplevelpage/fistchild is a 'Generic Page' but they need a toplevelpage/customchild but the parent URL is now owned by the Structured type.
  
  Can I get Craft or Twig to look for Singles or even Twig magic at that level and then just have a stub structured Generic Page that has is content overwritten?
  
  **Tags:** url, structure
  
  > **Comments:**
  > **username_1**: If I'm following you correctly, then sounds like a case for a dynamic route? https://craftcms.com/docs/routing#dynamic-routes  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-09-13. Score: 1 | Accepted answer
  
  First off, for communication reasons, let's refer to the "Structure" as a section, not a page type. Anytime you create either a Channel or Structure section, you have the ability to create what are called "entry types". You will see them listed on the far right of Settings > Sections in Craft.
  
  ### The Solution in a nutshell
  
  In your case, you will want to create a new **Entry Type** in your Structure to accommodate this custom deviant page, which will allow you to choose different fields for that type and its own template for its own custom code.
  
  ---
  
  ### What is an "Entry Type"?
  
  Ok, so what is an Entry Type? You know when you go to post a status on facebook and you have the ability to just write text, or you could choose to upload an image, or you might want to check in? All of these different types of status posts may share the same fields (like the text field to post your status), but some have additional or completely different fields (like uploading an image), but they are all "*Status Posts*" to Facebook, just different types of status posts. This is a *very* over-simplified example, I know, but it's kind of what Entry Types in Craft are for a Channel or Structure. They're like an inherent built-in category group that allow you to design different custom field layouts for different types of entries within that one Channel or Structure.
  
  So if you make a Structure called "Generic Pages", you could then create different entry types in that Structure like "Single Column", "With Sidebar", "Top Banner", etc, and they can all get their own custom field setup with their own templates. Or you could just use one template for them all. I've created Events channels before using things like "Event", "Concert", "Party", "Meetup", etc as the different types. When I create a new entry in the "Events" channel, I then choose which *type* of event it is, and by doing so, I'm able to customize which type gets which fields. They all have a "Start Date" field, but maybe the "Concert" type has a "Door Price" field, whereas "Meetup" doesn't. This way you don't have a confusing "Door Price" field for "Meetup" events that shouldn't be or don't need to be filled in.
  
  ---
  
  ### Templating
  
  Ok, so how do we handle this in the templates? When you create the section in Craft, you'll point to whatever template you want for the section as a whole (let's say `/generic-pages/_entry` for example). In that `_entry` template, add just this line:
  
  `{% include "generic-pages/" ~ entry.type %}`
  
  Then inside the `/generic-pages/` directory, you create a different template for each entry type you made in Craft. Name that template exactly how the handle looks like. So if you made a "Single Column" entry type and the handle is `singleColumn`, then "singleColumn.html" is the name of your template. Customize that template all you want.
  
  Here's a proper article on Craft's site talking about this method:
  <https://craftcms.com/support/entry-type-templates>
  
  Even if you're using one template for all entries in this Structure/Channel regardless of entry type, you can still be selective with how you grab your entries like:
  
  `{% set entries = craft.entries.section('genericPages').type('singleColumn') %}`
  
  Or be conditional based on type:
  
  ```
  {% if entry.type == 'concert' %}
      // do something
  {% endif %}
  
  ```
  
  ---
  
  Read more about Entry Types in the Craft Docs: <https://craftcms.com/docs/sections-and-entries#entry-types>
  
  > **Comments:**
  > **username_0**: Thank you username_2, I've used this detailed response to build a solution with a custom code block entry type as a workaround. What I originally wanted was to be able to take content from a Singles entry or even static HTML and replace the contents of a structured entry that is needed to maintain URL pattern.  
  > **username_2**: Ah no problem.  So it sounds like you added a Entries relation field to pull content in from the single?  Anyway, glad it helped and hope this explanation helps others down the road!  
  
  ---
  
  