<p>To set up a section (or check the one you are referring to), in your control panel, go to <strong>Settings</strong> then <strong>Sections</strong>.</p>

<p>To loop through entries on a template, for this service section for example, you do:</p>

<pre><code>{% for entry in craft.entries.section('services').all() %}
    {{ entry.title }} &lt;br&gt;
{% endfor %}
</code></pre>

<p>Hope that helps :)</p>

CC BY-SA 4.0
2019-01-31T15:41:03.813Z
Yes, I was confused if the section was an html section or a Craft section so this cleared things up. Thanks!
Tyrannogina regina
CC BY-SA 4.0
2019-01-31T12:25:57.020Z
2019-01-31T12:55:57.003Z
2019-01-31T12:55:57.003Z
Oli
<p>I am basically wondering where does this <code>section('services')</code> is set up and how. <a href="https://github.com/craftcms/demo/blob/3f224f1f2e260c3e18190b16420c2e661cbb35ee/templates/services/_entry.html#L22" rel="nofollow noreferrer">https://github.com/craftcms/demo/blob/3f224f1f2e260c3e18190b16420c2e661cbb35ee/templates/services/_entry.html#L22</a></p>

<p>I need to loop through the collection entries on the <code>_index.html</code> to display a small card for each one, but I don't know how to reach them from the index.</p>

<craft3><entries>
How can I loop through a collection in the index file?
# How can I loop through a collection in the index file?

(Asked by: username_0 on 2019-01-31)

I am basically wondering where does this `section('services')` is set up and how. <https://github.com/craftcms/demo/blob/3f224f1f2e260c3e18190b16420c2e661cbb35ee/templates/services/_entry.html#L22>

I need to loop through the collection entries on the `_index.html` to display a small card for each one, but I don't know how to reach them from the index.

**Tags:** craft3, entries


---

## 1 answers

### Answer by username_1 on 2019-01-31. Score: 3 | Accepted answer

To set up a section (or check the one you are referring to), in your control panel, go to Settings then Sections.
To loop through entries on a template, for this service section for example, you do:
{% for entry in craft.entries.section('services').all() %}
    {{ entry.title }} 
{% endfor %}

Hope that helps :)

> **Comments:**
> **username_0**: Yes, I was confused if the section was an html section or a Craft section so this cleared things up. Thanks!  

---

