I am using a table field to display credits on a portfolio page.
The table field has three columns: hva
, hvem
and url
.
The url
should be optional and I want to set up an if statement showing it as a link if it has a value. Is this possible using the table field?
Also, the table field can have multiple rows.
I have tried to set up an if for row.url
to see if has a value. And an else for when there is no URL.
{% if entry.credits|length %}
{% for row in entry.credits %}
{% if row.url == 0 %}
<li><span class="bold">{{ row.hva }}:</span> <a href="{{ row.url }}">{{ row.hvem }}</a></li>
{% else %}
<li><span class="bold">{{ row.hva }}:</span> {{ row.hvem }}</li>
{% endif %}
{% endfor %}
{% endif %}