-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-ssr.js
77 lines (65 loc) · 2.57 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.onRenderBody = void 0;
var _react = _interopRequireDefault(require("react"));
/**
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
*
* See: https://www.gatsbyjs.com/docs/ssr-apis/
*/
function buildInformationMessage() {
if (process.env.GATSBY_APPOINTLET_URL !== undefined) {
return /*#__PURE__*/_react.default.createElement("script", {
key: "appointlet_message",
dangerouslySetInnerHTML: {
__html: "\n console.log(\"Appointlet scheduling page URL \u2192 " + process.env.GATSBY_APPOINTLET_URL + "\")\n "
}
});
} else {
return /*#__PURE__*/_react.default.createElement("script", {
key: "appointlet_message",
dangerouslySetInnerHTML: {
__html: "\n console.error(\"Appointlet scheduling page URL (GATSBY_APPOINTLET_URL) not set !\")\n "
}
});
}
} // <script defer src="https://js.appointlet.com/"></script>
var scriptAppointlet = /*#__PURE__*/_react.default.createElement("script", {
key: 'scriptAppointlet',
id: 'scriptAppointlet',
type: 'text/javascript',
src: '//js.appointlet.com/',
defer: true
}); // <link href="https://js.appointlet.com/styles.css" rel="stylesheet" />
var styleAppointlet = /*#__PURE__*/_react.default.createElement("link", {
key: 'styleAppointlet',
id: 'styleAppointlet',
rel: 'stylesheet',
href: '//js.appointlet.com/styles.css'
}); // Lighthouse recommends pre-connecting
var preconnectStyleAppointlet = ( /*#__PURE__*/_react.default.createElement("link", {
rel: "preconnect",
key: "preconnect-style-appointlet",
href: "//js.appointlet.com/styles.css"
}), /*#__PURE__*/_react.default.createElement("link", {
rel: "dns-prefetch",
key: "dns-prefetch-style-appointlet",
href: "//js.appointlet.com/styles.css"
}));
var preconnectScriptAppointlet = ( /*#__PURE__*/_react.default.createElement("link", {
rel: "preconnect",
key: "preconnect-script-appointlet",
href: "//js.appointlet.com"
}), /*#__PURE__*/_react.default.createElement("link", {
rel: "dns-prefetch",
key: "dns-prefetch-script-appointlet",
href: "//js.appointlet.com"
}));
var onRenderBody = function onRenderBody(_ref) {
var setPostBodyComponents = _ref.setPostBodyComponents,
setHeadComponents = _ref.setHeadComponents;
setHeadComponents([]);
setPostBodyComponents([preconnectStyleAppointlet, preconnectScriptAppointlet, scriptAppointlet, styleAppointlet, buildInformationMessage()]);
};
exports.onRenderBody = onRenderBody;