forked from newrelic/developer-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-ssr.js
34 lines (30 loc) · 791 Bytes
/
gatsby-ssr.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/ssr-apis/
*/
import React, { createContext } from 'react';
import wrapPageElement from './gatsby/wrap-page-element';
global.window = {
__NR1_SDK__: {
default: {
PlatformStateContext: createContext(),
NerdletStateContext: createContext(),
ToastManager: () => null,
},
},
};
// This is needed to ensure the NR1 SDK can load properly
const onPreRenderHTML = ({
getPostBodyComponents,
replacePostBodyComponents,
}) => {
replacePostBodyComponents([
...getPostBodyComponents(),
<script
key="marketo-form"
src="//app-abj.marketo.com/js/forms2/js/forms2.min.js"
/>,
]);
};
export { onPreRenderHTML, wrapPageElement };