From f97a00bf05c6db2427269c6317bcb0b7bd0f170a Mon Sep 17 00:00:00 2001 From: philmcmahon Date: Wed, 6 Nov 2024 03:29:39 +0000 Subject: [PATCH] Set opengraph properties on interactive type --- common/app/model/content.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/app/model/content.scala b/common/app/model/content.scala index 2e38da8fcdc..7287bdea7ab 100644 --- a/common/app/model/content.scala +++ b/common/app/model/content.scala @@ -995,11 +995,21 @@ object Interactive { val fields = content.fields val section = content.metadata.sectionId + val opengraphProperties: Map[String, String] = Map( + ("og:type", "article"), + ("article:published_time", content.trail.webPublicationDate.toString()), + ("article:modified_time", content.fields.lastModified.toString()), + ("article:tag", content.tags.keywords.map(_.name).mkString(",")), + ("article:section", content.trail.sectionName), + ("article:publisher", "https://www.facebook.com/theguardian"), + ) + val metadata = content.metadata.copy( contentType = Some(contentType), adUnitSuffix = section + "/" + contentType.name.toLowerCase, twitterPropertiesOverrides = Map("twitter:title" -> fields.linkText), contentWithSlimHeader = InteractiveHeaderSwitch.isSwitchedOff, + opengraphPropertiesOverrides = opengraphProperties ) val contentOverrides = content.copy( metadata = metadata,