UNPKG

gatsby-plugin-react-helmet

Version:

Manage document head data with react-helmet. Provides drop-in server rendering support for Gatsby.

24 lines (16 loc) 886 B
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _reactHelmet = _interopRequireDefault(require("react-helmet")); exports.onRenderBody = function (_ref, pluginOptions) { var setHeadComponents = _ref.setHeadComponents, setHtmlAttributes = _ref.setHtmlAttributes, setBodyAttributes = _ref.setBodyAttributes; var helmet = _reactHelmet.default.renderStatic(); // These action functions were added partway through the Gatsby 1.x cycle. if (setHtmlAttributes) { setHtmlAttributes(helmet.htmlAttributes.toComponent()); } if (setBodyAttributes) { setBodyAttributes(helmet.bodyAttributes.toComponent()); } setHeadComponents([helmet.title.toComponent(), helmet.link.toComponent(), helmet.meta.toComponent(), helmet.noscript.toComponent(), helmet.script.toComponent(), helmet.style.toComponent()]); };