11import { isString } from '@guardian/libs' ;
22import { ConfigProvider } from '../components/ConfigContext' ;
33import { HostedContentPage } from '../components/HostedContentPage' ;
4+ import { getArticleThemeString } from '../lib/articleFormat' ;
45import {
56 ASSET_ORIGIN ,
67 generateScriptTags ,
@@ -19,7 +20,7 @@ type Props = {
1920} ;
2021
2122export const renderHtml = ( { hostedContent } : Props ) => {
22- const { frontendData } = hostedContent ;
23+ const { frontendData, theme } = hostedContent ;
2324
2425 const title = `Advertiser content hosted by the Guardian: ${ frontendData . webTitle } | The Guardian` ;
2526
@@ -90,21 +91,31 @@ export const renderHtml = ({ hostedContent }: Props) => {
9091 unknownConfig : frontendData . config ,
9192 } ) ;
9293
94+ const { linkedData, openGraphData, canonicalUrl } = frontendData ;
95+ const maybeArticleThemeString = getArticleThemeString ( theme ) ;
96+
9397 /**
9498 * @todo Create a separate hosted content page template
9599 */
96100 const pageHtml = htmlPageTemplate ( {
101+ linkedData,
97102 scriptTags,
98103 css : extractedCss ,
99104 html,
100105 title,
101- description : frontendData . standfirst ,
106+ description : frontendData . trailText ,
102107 guardian,
103- canonicalUrl : '' ,
108+ openGraphData,
109+ section : frontendData . config . section ,
110+ canonicalUrl,
104111 renderingTarget : 'Web' ,
105- // @ts -expect-error no config data
106- config : { } ,
107- weAreHiring : false ,
112+ weAreHiring : ! ! frontendData . config . switches . weAreHiring ,
113+ config,
114+ dataAttributes : {
115+ ...( maybeArticleThemeString && {
116+ 'article-theme' : maybeArticleThemeString ,
117+ } ) ,
118+ } ,
108119 } ) ;
109120
110121 return { html : pageHtml , prefetchScripts } ;
0 commit comments