I appreciate that the featured content slider is primarily supposed to be used for ‘featuring content’, but it’s definitely not always the case that adding a link is appropriate. Sometimes you just want to use the slides as an image in a carousel for example, or maybe a single slide as a header image.
Given that that field is a requirement, my solution to removing the link for featured content slides is as follows.
Enter the current page slug in the page to feature field.
In your featured content slider theme code add an if/else statement to check if the returned value for the ‘feature.page.url’ value is equal to the current page url (page.url). You can now remove the link when the statement is true:
{% if feature.page.url == page.url %} <span class="features-headline">{{ feature.headline }}</span> {% else % } <a class="features-headline" href="{{ feature.page.url }}">{{ feature.headline }}</a> {% endif %}
Maybe there’s a more elegant solution, so I’m all ears, but it does the job.
Leave a Reply