diff --git a/agaric/templates/paragraph/paragraph--slide.html.twig b/agaric/templates/paragraph/paragraph--slide.html.twig index a40247e..754ead0 100644 --- a/agaric/templates/paragraph/paragraph--slide.html.twig +++ b/agaric/templates/paragraph/paragraph--slide.html.twig @@ -1,8 +1,17 @@ +{# Damn you to hell, Drupal, this should not be anywhere near this complicated #} +{# Credit to leymannx, https://drupal.stackexchange.com/a/247807/4195 #} +{% if paragraph.field_link.0.url.external %} + {% set url = paragraph.field_link.uri %} +{% elseif paragraph.field_link.0.url.routeName %} + {% set url = path(paragraph.field_link.0.url.routeName, paragraph.field_link.0.url.routeParameters) %} +{% else %} + {% set url = "" %} +{% endif %} {# Include slide component template. #} {% include '@agaric/components/slide.html.twig' with { image: content.field_image, text: content.field_text, - url: content.field_link, + url: url, } only %}