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)