From 8fa30325594e63cc4e8132aa14ce9f161343f356 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 2 May 2023 00:33:10 +0100 Subject: [PATCH] fix(daily-email): don't add a CTA if one exists --- src/pages/rss/daily.xml.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pages/rss/daily.xml.js b/src/pages/rss/daily.xml.js index 85153940..80ba7b9f 100644 --- a/src/pages/rss/daily.xml.js +++ b/src/pages/rss/daily.xml.js @@ -15,8 +15,12 @@ export async function get() { const parser = new MarkdownIt(); - const callToAction = () => { - return _.sample([ + const callToAction = (emailBody) => { + if (emailBody.includes('P.S.')) { + return ''; + } + + return '
P.S. ' + _.sample([ 'Are you still using Drupal 7 and don’t know what’s involved to upgrade to Drupal 10? Book a Drupal 7 upgrade consultation call.', 'Need help or want another pair of eyes on your code? Book a 1-on-1 consulting call or an online pair programming session with a 100% money-back guarantee.', 'If you\'re creating a new Drupal module, try my free Drupal module template.', @@ -43,8 +47,7 @@ export async function get() { description: `
${sanitizeHtml(parser.render(email.body))} -
-

P.S. ${callToAction()}

+ ${callToAction(email.body)}
`, link: `${import.meta.env.SITE}/${email.data.permalink}`,