{% if entry is defined %}
  {% if entry.components is defined %}
    {% if entry.components.count() > 0 %}
      {% for i in entry.components.all() %}
        {% include 'components/_' ~ i.type with {
          id: 'item-' ~ i.type ~ '-' ~ loop.index0,
          component: i,
          index: loop
        } only %}
      {% endfor %}
    {% endif %}
  {% endif %}
{% endif %}
