From 527ddf71a01f47eaa6934108504c7d59e2e84ae4 Mon Sep 17 00:00:00 2001 From: Ravi <7014230+arelra@users.noreply.github.com> Date: Wed, 17 Apr 2024 12:42:13 +0100 Subject: [PATCH 1/3] Add canonical link to fronts Co-authored-by: Ioanna Kokkini --- .../dotcomrendering/DotcomFrontsRenderingDataModel.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala index 505dc949164c..fb48a800d5e1 100644 --- a/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala @@ -1,6 +1,6 @@ package model.dotcomrendering -import common.Edition +import common.{CanonicalLink, Edition} import common.Maps.RichMap import common.commercial.EditionCommercialProperties import conf.Configuration @@ -32,6 +32,7 @@ case class DotcomFrontsRenderingDataModel( mostShared: Option[Trail], deeplyRead: Option[Seq[Trail]], contributionsServiceUrl: String, + canonicalUrl: String ) object DotcomFrontsRenderingDataModel { @@ -93,6 +94,7 @@ object DotcomFrontsRenderingDataModel { mostShared = mostShared.flatMap(ContentCard.fromApiContent).flatMap(Trail.contentCardToTrail), deeplyRead = deeplyRead, contributionsServiceUrl = Configuration.contributionsService.url, + canonicalUrl = CanonicalLink(request, page.metadata.webUrl) ) } From 811d737f18a8ce233f23ead6727e355f417a2522 Mon Sep 17 00:00:00 2001 From: Ravi <7014230+arelra@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:19:05 +0100 Subject: [PATCH 2/3] Add canonical link to tag pages Co-authored-by: Ioanna Kokkini --- .../dotcomrendering/DotcomTagPagesRenderingDataModel.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala index 5b34e3b74280..47173f69efe1 100644 --- a/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala @@ -1,11 +1,11 @@ package model.dotcomrendering -import common.Edition +import common.{CanonicalLink, Edition} import common.Maps.RichMap import common.commercial.EditionCommercialProperties import conf.Configuration import experiments.ActiveExperiments -import model.{MetaData, Tags} +import model.Tags import model.pressed.PressedContent import navigation.{FooterLinks, Nav} import org.joda.time.{DateTime, DateTimeZone} @@ -34,6 +34,7 @@ case class DotcomTagPagesRenderingDataModel( commercialProperties: Map[String, EditionCommercialProperties], pageFooter: PageFooter, isAdFreeUser: Boolean, + canonicalUrl: String, ) object DotcomTagPagesRenderingDataModel { @@ -60,6 +61,7 @@ object DotcomTagPagesRenderingDataModel { "commercialProperties" -> model.commercialProperties, "pageFooter" -> model.pageFooter, "isAdFreeUser" -> model.isAdFreeUser, + "canonicalUrl" -> model.canonicalUrl ) } } @@ -123,6 +125,7 @@ object DotcomTagPagesRenderingDataModel { commercialProperties = commercialProperties, pageFooter = PageFooter(FooterLinks.getFooterByEdition(Edition(request))), isAdFreeUser = views.support.Commercial.isAdFree(request), + canonicalUrl = CanonicalLink(request, page.metadata.webUrl) ) } From c370b6825c87fc8af48852395db3c3fafdabe000 Mon Sep 17 00:00:00 2001 From: Ravi <7014230+arelra@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:21:15 +0100 Subject: [PATCH 3/3] Scalafmt --- .../dotcomrendering/DotcomFrontsRenderingDataModel.scala | 4 ++-- .../dotcomrendering/DotcomTagPagesRenderingDataModel.scala | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala index fb48a800d5e1..dbec33a6051b 100644 --- a/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala @@ -32,7 +32,7 @@ case class DotcomFrontsRenderingDataModel( mostShared: Option[Trail], deeplyRead: Option[Seq[Trail]], contributionsServiceUrl: String, - canonicalUrl: String + canonicalUrl: String, ) object DotcomFrontsRenderingDataModel { @@ -94,7 +94,7 @@ object DotcomFrontsRenderingDataModel { mostShared = mostShared.flatMap(ContentCard.fromApiContent).flatMap(Trail.contentCardToTrail), deeplyRead = deeplyRead, contributionsServiceUrl = Configuration.contributionsService.url, - canonicalUrl = CanonicalLink(request, page.metadata.webUrl) + canonicalUrl = CanonicalLink(request, page.metadata.webUrl), ) } diff --git a/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala index 47173f69efe1..03fb0fd9ebd0 100644 --- a/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala @@ -61,7 +61,7 @@ object DotcomTagPagesRenderingDataModel { "commercialProperties" -> model.commercialProperties, "pageFooter" -> model.pageFooter, "isAdFreeUser" -> model.isAdFreeUser, - "canonicalUrl" -> model.canonicalUrl + "canonicalUrl" -> model.canonicalUrl, ) } } @@ -125,7 +125,7 @@ object DotcomTagPagesRenderingDataModel { commercialProperties = commercialProperties, pageFooter = PageFooter(FooterLinks.getFooterByEdition(Edition(request))), isAdFreeUser = views.support.Commercial.isAdFree(request), - canonicalUrl = CanonicalLink(request, page.metadata.webUrl) + canonicalUrl = CanonicalLink(request, page.metadata.webUrl), ) }