diff --git a/src/site/filters/liquid.js b/src/site/filters/liquid.js index 59fd0740ae..f2c9686312 100644 --- a/src/site/filters/liquid.js +++ b/src/site/filters/liquid.js @@ -2122,4 +2122,14 @@ module.exports = function registerFilters() { return platform; }; + + liquid.filters.determineFieldLink = fieldLink => { + if (!_.isEmpty(fieldLink?.url?.path)) { + return fieldLink.url.path; + } + if (!_.isEmpty(fieldLink?.uri)) { + return fieldLink.uri; + } + return null; + }; }; diff --git a/src/site/layouts/campaign_landing_page.drupal.liquid b/src/site/layouts/campaign_landing_page.drupal.liquid index 17f89b21a8..ad7f929aaa 100644 --- a/src/site/layouts/campaign_landing_page.drupal.liquid +++ b/src/site/layouts/campaign_landing_page.drupal.liquid @@ -110,10 +110,10 @@ width="{{ promo.entity.fieldImage.entity.thumbnail.derivative.width }}" />

- + {% assign fieldUrl = promo.entity.fieldPromoLink.entity.fieldLink | determineFieldLink %} + {% if fieldUrl %} + + {% endif %}

{{ promo.entity.fieldPromoLink.entity.fieldLinkSummary }} @@ -206,10 +206,10 @@

- + {% assign fieldUrl = linkTeaser.entity.fieldLink | determineFieldLink %} + {% if fieldUrl %} + + {% endif %}

{{ linkTeaser.entity.fieldLinkSummary }}

@@ -248,10 +248,10 @@ {% endif %}

- + {% assign fieldUrl = storyTeaser.entity.fieldLinkTeaser.entity.fieldLink | determineFieldLink %} + {% if fieldUrl %} + + {% endif %}

{{ storyTeaser.entity.fieldLinkTeaser.entity.fieldLinkSummary }}

@@ -341,6 +341,7 @@

{% if eventReference.entity.entityUrl.path and eventReference.entity.title %} + {% if eventReference.entity.fieldLink.uri and eventReference.entity.fieldEventCta %} - + {% assign fieldUrl = eventReference.entity.fieldLink| determineFieldLink %} + {% if fieldUrl %} + + {% endif %} {% endif %} diff --git a/src/site/stages/build/drupal/graphql/nodeCampaignLandingPage.graphql.js b/src/site/stages/build/drupal/graphql/nodeCampaignLandingPage.graphql.js index 3c4313bd1e..69641b80fc 100644 --- a/src/site/stages/build/drupal/graphql/nodeCampaignLandingPage.graphql.js +++ b/src/site/stages/build/drupal/graphql/nodeCampaignLandingPage.graphql.js @@ -154,6 +154,9 @@ const nodeCampaignLandingPage = ` ... on ParagraphLinkTeaser { fieldLink { uri + url { + path + } title } fieldLinkSummary @@ -179,6 +182,9 @@ const nodeCampaignLandingPage = ` ... on ParagraphLinkTeaser { fieldLink { uri + url { + path + } title } fieldLinkSummary @@ -257,6 +263,9 @@ const nodeCampaignLandingPage = ` fieldLink { uri title + url { + path + } } fieldLinkSummary }