From f88b87a2c6bf4611e62cf0cbf189ec535c3be0e6 Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Tue, 21 May 2024 11:22:26 +0100 Subject: [PATCH] Add explainer comment --- common/app/model/dotcomrendering/DotcomRenderingUtils.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/app/model/dotcomrendering/DotcomRenderingUtils.scala b/common/app/model/dotcomrendering/DotcomRenderingUtils.scala index 25fb9261d1dc..1f6875d6fd2e 100644 --- a/common/app/model/dotcomrendering/DotcomRenderingUtils.scala +++ b/common/app/model/dotcomrendering/DotcomRenderingUtils.scala @@ -245,6 +245,12 @@ object DotcomRenderingUtils { def shouldAddAffiliateLinks(content: ContentType)(implicit request: RequestHeader): Boolean = { val contentHtml = Jsoup.parse(content.fields.body) val bodyElements = contentHtml.select("body").first().children() + /** + * On smaller devices, the disclaimer is inserted before paragraph 2 of the article body and floats left. + * This logic ensures there are two clear paragraphs of text at the top of the article. + * We don't support inserting the disclaimer next to other element types. + * It also ensures the second paragraph is long enough to accommodate the disclaimer appearing alongside it. + */ if (bodyElements.size >= 2) { val firstEl = bodyElements.get(0) val secondEl = bodyElements.get(1)