Skip to content

Commit 6d78d54

Browse files
committed
bring hosted content render closer to article for page template args
1 parent 7779591 commit 6d78d54

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

dotcom-rendering/src/server/render.hostedContent.web.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { isString } from '@guardian/libs';
22
import { ConfigProvider } from '../components/ConfigContext';
33
import { HostedContentPage } from '../components/HostedContentPage';
4+
import { getArticleThemeString } from '../lib/articleFormat';
45
import {
56
ASSET_ORIGIN,
67
generateScriptTags,
@@ -19,7 +20,7 @@ type Props = {
1920
};
2021

2122
export 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

Comments
 (0)