Answers.Body: <p>Entry templates are assigned on a per-section basis, and each section can only have a single entry template per site.</p>
  <p>The workaround is to create a &quot;proxy&quot; template and use that as your section's entry template. The only responsibility for the proxy template is to <code>{% include %}</code> another template (the actual entry template), based on some conditions.</p>
  <p>Here's how that proxy template could look in your case:</p>
  <pre><code>{% if entry.slug == 'newsletter' %}
  
      {# Use a special template for the &quot;Newsletter&quot; entry #}
      {% include 'newsletter/index' %}
  
  {% else %}
  
      {# All other entries use a default &quot;page&quot; template #}
      {% include 'pages/page' %}
  
  {% endif %}
  </code></pre>
  <p>Note: Using <code>entry.slug</code> (or <code>entry.id</code>, <code>entry.title</code> etc) for something like this is a bit fragile, because your content editor can easily change the slug and at that point the conditional will fail and the wrong template would be loaded.</p>
  <p>A better approach is to add multiple entry types to your section (e.g. a &quot;Newsletter&quot; entry type and a &quot;Page&quot; entry type), and change the conditional to use that:</p>
  <pre><code>{% if entry.type.handle == 'newsletter' %}
  
      {% include 'newsletter/index' %}
  
  {% else %}
  
      ...
  </code></pre>
  <p>Using different entry types also enables you to have different fields for different kinds of entries within the same section (which you'd typically want, when you're loading completely different templates for those entries).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-30T09:15:20.337Z
Answers.LastActivityDate: 2020-07-30T09:37:33.267Z
Answers.LastEditDate: 2020-07-30T09:37:33.267Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I have added a &quot;newsletter&quot; page under Admin &gt; Entries &gt; Page [New Entry]
  And the page is opening fine on the url <strong>xyz.com/newsletter</strong></p>
  <p>But I want to assign a different template to this url, how can I do that?
  I tried creating a folder at <strong>/templates/newsletter/index.twig</strong> but that is not working at all.</p>
  
Tags: <templating><craft3>
Title: How to create different template for specific page?
ThreadText: # How to create different template for specific page?
  
  (Asked by: username_0 on 2020-07-30)
  
  I have added a "newsletter" page under Admin > Entries > Page [New Entry]
  And the page is opening fine on the url **xyz.com/newsletter**
  
  But I want to assign a different template to this url, how can I do that?
  I tried creating a folder at **/templates/newsletter/index.twig** but that is not working at all.
  
  **Tags:** templating, craft3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-07-30. Score: 2 | Accepted answer
  
  Entry templates are assigned on a per-section basis, and each section can only have a single entry template per site.
  
  The workaround is to create a "proxy" template and use that as your section's entry template. The only responsibility for the proxy template is to `{% include %}` another template (the actual entry template), based on some conditions.
  
  Here's how that proxy template could look in your case:
  
  ```
  {% if entry.slug == 'newsletter' %}
  
      {# Use a special template for the "Newsletter" entry #}
      {% include 'newsletter/index' %}
  
  {% else %}
  
      {# All other entries use a default "page" template #}
      {% include 'pages/page' %}
  
  {% endif %}
  
  ```
  
  Note: Using `entry.slug` (or `entry.id`, `entry.title` etc) for something like this is a bit fragile, because your content editor can easily change the slug and at that point the conditional will fail and the wrong template would be loaded.
  
  A better approach is to add multiple entry types to your section (e.g. a "Newsletter" entry type and a "Page" entry type), and change the conditional to use that:
  
  ```
  {% if entry.type.handle == 'newsletter' %}
  
      {% include 'newsletter/index' %}
  
  {% else %}
  
      ...
  
  ```
  
  Using different entry types also enables you to have different fields for different kinds of entries within the same section (which you'd typically want, when you're loading completely different templates for those entries).
  
  
  ---
  
  