Skip to content

Commit

Permalink
Add explainer comment
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-imber committed May 21, 2024
1 parent bb2cbb8 commit f88b87a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions common/app/model/dotcomrendering/DotcomRenderingUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f88b87a

Please sign in to comment.