-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgatsby-ssr.js
29 lines (29 loc) · 1.19 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
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var react_helmet_async_1 = require("react-helmet-async");
var context = {};
exports.onRenderBody = function (_a) {
var setHeadComponents = _a.setHeadComponents, setHtmlAttributes = _a.setHtmlAttributes, setBodyAttributes = _a.setBodyAttributes;
var helmet = context.helmet;
if (helmet != null) {
setHeadComponents([
helmet.base.toComponent(),
helmet.title.toComponent(),
helmet.meta.toComponent(),
helmet.link.toComponent(),
helmet.style.toComponent(),
helmet.script.toComponent(),
helmet.noscript.toComponent(),
]);
setHtmlAttributes(helmet.htmlAttributes.toComponent());
setBodyAttributes(helmet.bodyAttributes.toComponent());
}
};
exports.wrapRootElement = function (_a) {
var element = _a.element;
return (react_1.default.createElement(react_helmet_async_1.HelmetProvider, { context: context }, element));
};