Answers.Body: <p>You basically have two options for creating a "listing" or "archive" view for your Channel or Structure sections.</p>
  
  <p>The first option is to create a Single. This is in many cases appropriate, e.g. if you need to add content to the listing view in addition to the actual entry list, such as a visual banner, introductory text etc.</p>
  
  <p>Inside the Single section's entry template, you'll need to pull the entries you want to display in the list using <code>craft.entries</code> – here's a very basic example for how the Single section's entry template could look:</p>
  
  <pre><code>{% extends '_layout' %}
  
  {% block content %}
  
      {# Display some content from our Single #}
      &lt;h1&gt;{{ entry.title }}&lt;/h1&gt;
      &lt;p&gt;{{ entry.introduction }}&lt;/p&gt;
  
      {# ...and a list of entries in the "news" Section #}
      &lt;h2&gt;Entries&lt;/h2&gt;
      &lt;ul&gt;
          {% for newsEntry in craft.entries.section('news') %}
              &lt;li&gt;&lt;a href="{{ newsEntry.url }}"&gt;{{ newsEntry.title }}&lt;/a&gt;&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  
  {% endblock %}
  </code></pre>
  
  <p>The second option is to <em>not</em> create a Single :) Of course, then you need to solve the problem of there not being an actual URL for your "archive" or "list" view.</p>
  
  <p>There are many ways to approach this, but a simple and good solution to this problem is to leverage Craft's template routing pattern. If your Channel or Structure section's URL format is <code>news/{slug}</code>, and the entry template is <code>news/_entry.html</code>, you can simply create a template called <code>news/index.html</code>, and Craft will render that template for any requests to <code>example.com/news</code>.</p>
  
  <p>Without a Single, the <code>templates/news/index.html</code> template will look much the same as the above example (you'll still need the <code>craft.entries</code> query to actually pull the entries) albeit without a pre-populated <code>entry</code> variable:</p>
  
  <pre><code>{% extends '_layout' %}
  
  {% block content %}
  
      &lt;h1&gt;News archive&lt;/h1&gt;
      &lt;p&gt;Here's our awesome news archive&lt;/p&gt;
  
      &lt;h2&gt;Entries&lt;/h2&gt;
      &lt;ul&gt;
          {% for entry in craft.entries.section('news') %}
              &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  
  {% endblock %}
  </code></pre>
  
  <p>About "Craft's template routing pattern" mentioned above; these are two important things to know about:</p>
  
  <p>– Whenever Craft can't match a URL request to an entry or category (and also no <a href="https://craftcms.com/docs/routing#dynamic-routes" rel="noreferrer">dynamic routes</a>) it'll look for a matching template <em>path</em>. This means that if there's no entry or category with a URL format matching the request <code>example.com/news</code>, Craft will look for a template with the filepath <code>/templates/news/index.html</code>. If that template exists, Craft will render it.</p>
  
  <p>– Any template prefixed with an underscore (or in a folder prefixed with an underscore), such as <code>/templates/news/_entry</code>, is excluded from template routing. This means that Craft won't match the URL <code>example.com/news/entry</code> to the <code>news/_entry.html</code> template.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-19T14:58:59.203Z
Answers.LastActivityDate: 2016-10-19T15:04:55.273Z
Answers.LastEditDate: 2016-10-19T15:04:55.273Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I am wondering if there is a best practice around using channels and structures. When you have a single section you can link to that section by selecting the entry for it. For channels and structures there is no "entry" that represents the landing page where I just want to display the list of entries. Do I need to create a single section as the landing page and loop entries from my channel section in order to link to that landing page?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-19T13:54:33.627Z
Comments.Text: There is an "entries" field which gives you the abillity to select any entries including structures and channels which you can display from there on. If this is not what you are looking for could you be more clear?
Comments.UserDisplayName: Justin Dekkers
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-19T14:21:37.117Z
Comments.Text: I reworded my issue
Comments.UserDisplayName: jpoiri
Tags: <structure><channels><best-practice>
Title: Best practice for channels and structures
ThreadText: # Best practice for channels and structures
  
  (Asked by: username_0 on 2016-10-19)
  
  I am wondering if there is a best practice around using channels and structures. When you have a single section you can link to that section by selecting the entry for it. For channels and structures there is no "entry" that represents the landing page where I just want to display the list of entries. Do I need to create a single section as the landing page and loop entries from my channel section in order to link to that landing page?
  
  **Tags:** structure, channels, best-practice
  
  > **Comments:**
  > **username_1**: There is an "entries" field which gives you the abillity to select any entries including structures and channels which you can display from there on. If this is not what you are looking for could you be more clear?  
  > **username_0**: I reworded my issue  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-10-19. Score: 7
  
  You basically have two options for creating a "listing" or "archive" view for your Channel or Structure sections.
  
  The first option is to create a Single. This is in many cases appropriate, e.g. if you need to add content to the listing view in addition to the actual entry list, such as a visual banner, introductory text etc.
  
  Inside the Single section's entry template, you'll need to pull the entries you want to display in the list using `craft.entries` – here's a very basic example for how the Single section's entry template could look:
  
  ```
  {% extends '_layout' %}
  
  {% block content %}
  
      {# Display some content from our Single #}
      <h1>{{ entry.title }}</h1>
      <p>{{ entry.introduction }}</p>
  
      {# ...and a list of entries in the "news" Section #}
      <h2>Entries</h2>
      <ul>
          {% for newsEntry in craft.entries.section('news') %}
              <li><a href="{{ newsEntry.url }}">{{ newsEntry.title }}</a></li>
          {% endfor %}
      </ul>
  
  {% endblock %}
  
  ```
  
  The second option is to *not* create a Single :) Of course, then you need to solve the problem of there not being an actual URL for your "archive" or "list" view.
  
  There are many ways to approach this, but a simple and good solution to this problem is to leverage Craft's template routing pattern. If your Channel or Structure section's URL format is `news/{slug}`, and the entry template is `news/_entry.html`, you can simply create a template called `news/index.html`, and Craft will render that template for any requests to `example.com/news`.
  
  Without a Single, the `templates/news/index.html` template will look much the same as the above example (you'll still need the `craft.entries` query to actually pull the entries) albeit without a pre-populated `entry` variable:
  
  ```
  {% extends '_layout' %}
  
  {% block content %}
  
      <h1>News archive</h1>
      <p>Here's our awesome news archive</p>
  
      <h2>Entries</h2>
      <ul>
          {% for entry in craft.entries.section('news') %}
              <li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
          {% endfor %}
      </ul>
  
  {% endblock %}
  
  ```
  
  About "Craft's template routing pattern" mentioned above; these are two important things to know about:
  
  – Whenever Craft can't match a URL request to an entry or category (and also no [dynamic routes](https://craftcms.com/docs/routing#dynamic-routes)) it'll look for a matching template *path*. This means that if there's no entry or category with a URL format matching the request `example.com/news`, Craft will look for a template with the filepath `/templates/news/index.html`. If that template exists, Craft will render it.
  
  – Any template prefixed with an underscore (or in a folder prefixed with an underscore), such as `/templates/news/_entry`, is excluded from template routing. This means that Craft won't match the URL `example.com/news/entry` to the `news/_entry.html` template.
  
  
  ---
  
  