So I am using the matrix field to enable uploading of images onto a slideshow for the homepage section. My goal is to have one of the images link to another URL when you click on it. Basic stuff when using plain HTML, but I have it setup like this in Twig:
{% for block in entry.information %}
{% if block.type == "images" %}
{% set image = block.image.first() %}
{% if image %}
<a href={{ block.anchor | cacheBuster }} target="_blank">
<img class="slideshow" src={{ image.url | cacheBuster }} alt={{ image.title }}>
</a>
{% endif %}
{% endif %}
{% endfor %}
This code runs fine and my slideshow images are all displayed using just one loop.
The problem is, all my slides are having an anchor field activated. I only want one of the slides to have a link to a URL, however, in the future I may want to add links to other slides so I need something that is also dynamic enough to support this.
My whole entire approach may be wrong and I might need to use a completely different approach... assistance is greatly appreciated.