in src/server/lib/renderer.tsx [108:166]
export const renderer: <P extends RoutePaths>(
url: P,
opts: RendererOpts,
tokenisationParams?: PathParams<P>,
) => string = (url, { requestState, pageTitle }, tokenisationParams) => {
const clientState = clientStateFromRequestStateLocals(requestState);
const location = buildUrl(url, tokenisationParams);
const { abTesting: { mvtId = 0, forcedTestVariants = {} } = {} } =
clientState;
// Any changes made here must also be made to the hydration in the static webpack bundle
const react = ReactDOMServer.renderToString(
<ABProvider
arrayOfTestObjects={tests}
abTestSwitches={abSwitches}
pageIsSensitive={false}
mvtMaxValue={1000000}
mvtId={mvtId}
forcedTestVariants={forcedTestVariants}
serverSideTests={{}}
errorReporter={() => {}}
ophanRecord={() => {}}
>
<App {...clientState} location={location}></App>
</ABProvider>,
);
const routingConfig: RoutingConfig = {
clientState,
location,
};
const scriptTags = getScriptTags(isSafari10Or11(requestState.browser));
return `
<!DOCTYPE html>
<!-- Request ID: ${clientState.shortRequestId} -->
<html lang="en">
<head>
<meta charset='utf-8' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="${brandBackground.primary}" />
<link rel="icon" href="https://static.guim.co.uk/images/${favicon}">
<title>${pageTitle} | The Guardian</title>
<script src="https://assets.guim.co.uk/polyfill.io/v3/polyfill.min.js?features=es2015%2Ces2016%2Ces2017%2Ces2018%2Ces2019%2Ces2020%2Ces2021%2Ces2022%2Cfetch%2CglobalThis%2CURLSearchParams" defer></script>
${scriptTags}
<script id="routingConfig" type="application/json">${serialize(routingConfig, { isJSON: true })}</script>
<style>${resets.defaults}</style>
</head>
<body style="margin:0">
<div id="app">${react}</div>
</body>
</html>
`;
};