1

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.

3

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 }} <br>
{% endfor %}

Hope that helps :)

1
  • Yes, I was confused if the section was an html section or a Craft section so this cleared things up. Thanks! Jan 31 '19 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.