I need to loop related entries.
I am using a SuperTable field with the handle "related" with an entry field with the handle "contentEntry" and two text fields for alternative text and descriptions.
The "contentEntry" field is limited to two entries being selected. The issue I'm having is that the following code repeats the first entry twice and doesn't loop and display the second. What am I doing wrong?
{# Related Entry #}
{% set relatedEntries = block.related.all %}
{% set relatedEntry = block.related.contentEntry.all() %}
{% set relatedAltDesc = block.related.altDescription %}
{% set relatedAltTitle = block.related.altTitle %}
{% if relatedEntries %}
<div class="{{ padding }} {{ fontsize }}" id="{{ blockID }}">
<div class="{{ margin }}">
{% for entries in relatedEntries %}
{% for rel in relatedEntry %}
{% if relatedAltTitle %}
{{ relatedAltTitle }}
{% else %}
{{ rel.title }}
{% endif %}
{% if relatedAltDesc %}
{{ relatedAltDesc }}
{% else %}
{{ rel.previewDescription }}
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>
{% endif %}