Skip to content

Commit

Permalink
Merge pull request #27060 from guardian/facia-add-canonical-link
Browse files Browse the repository at this point in the history
Add canonical url to the DCR rendering model for Fronts and Tag Pages
  • Loading branch information
arelra authored Apr 18, 2024
2 parents 67dd46d + c370b68 commit 8b4c991
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -32,6 +32,7 @@ case class DotcomFrontsRenderingDataModel(
mostShared: Option[Trail],
deeplyRead: Option[Seq[Trail]],
contributionsServiceUrl: String,
canonicalUrl: String,
)

object DotcomFrontsRenderingDataModel {
Expand Down Expand Up @@ -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),
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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}
Expand Down Expand Up @@ -34,6 +34,7 @@ case class DotcomTagPagesRenderingDataModel(
commercialProperties: Map[String, EditionCommercialProperties],
pageFooter: PageFooter,
isAdFreeUser: Boolean,
canonicalUrl: String,
)

object DotcomTagPagesRenderingDataModel {
Expand All @@ -60,6 +61,7 @@ object DotcomTagPagesRenderingDataModel {
"commercialProperties" -> model.commercialProperties,
"pageFooter" -> model.pageFooter,
"isAdFreeUser" -> model.isAdFreeUser,
"canonicalUrl" -> model.canonicalUrl,
)
}
}
Expand Down Expand Up @@ -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),
)
}

Expand Down

0 comments on commit 8b4c991

Please sign in to comment.