Skip to content

Instantly share code, notes, and snippets.

@nealoke
Created May 18, 2018 09:53
Show Gist options
  • Save nealoke/18b893de665b1be481c086fc6a3ea4cb to your computer and use it in GitHub Desktop.
Save nealoke/18b893de665b1be481c086fc6a3ea4cb to your computer and use it in GitHub Desktop.
Problem with meta tags
import React from "react";
import { Router } from "react-router-dom";
import { Provider } from "react-redux";
import createStore from "./src/state/createStore";
import intercom from "./src/assets/snippets/intercom";
import Modals from "./src/containers/Modals";
import Cookie from "./src/containers/Cookie";
exports.replaceRouterComponent = ({ history }) => {
const store = createStore();
const ConnectedRouterWrapper = ({ children }) => (
<Provider store={store}>
<div>
<Modals />
<Cookie />
<Router history={history}>{children}</Router>
</div>
</Provider>
);
return ConnectedRouterWrapper;
};
exports.onInitialClientRender = () => {
intercom();
window.Intercom("boot", { app_id: "yjdyipzg" });
};
module.exports = {
siteMetadata: {
title: "title",
siteUrl: "urlToWebsite"
},
plugins: [
"gatsby-plugin-react-helmet",
"gatsby-plugin-sass",
{
resolve: "gatsby-plugin-google-analytics",
options: {
trackingId: "xxx"
}
},
{
resolve: "gatsby-plugin-sitemap"
},
{
resolve: "gatsby-plugin-facebook-pixel",
options: {
pixelId: "xxx"
}
},
{
resolve: "gatsby-plugin-google-tagmanager",
options: {
id: "xxx",
includeInDevelopment: false
}
}
]
};
exports.onCreatePage = ({ page, boundActionCreators }) => {
const { createPage } = boundActionCreators;
return new Promise((resolve, reject) => {
if (page.path.match(/^\/demo/)) {
page.layout = "barebones";
createPage(page);
}
resolve();
});
};
exports.modifyBabelrc = ({ babelrc }) =>
Object.assign({}, babelrc, {
plugins: babelrc.plugins.concat([
"lodash",
[
"transform-imports",
{
"@nealoke/wizer-components": {
transform: "@nealoke/wizer-components/src/${member}",
preventFullImport: true
},
"@nealoke/wizer-utils": {
transform: "@nealoke/wizer-utils/src/${member}",
preventFullImport: true
}
}
]
])
});
import React from "react";
import { Provider } from "react-redux";
import { renderToString } from "react-dom/server";
import createStore from "./src/state/createStore";
exports.replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => {
const store = createStore();
const ConnectedBody = () => <Provider store={store}>{bodyComponent}</Provider>;
replaceBodyHTMLString(renderToString(<ConnectedBody />));
};
{
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.24.1",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-transform-imports": "^1.4.1",
"babel-preset-es2015": "^6.24.1",
"breakpoint-sass": "^2.7.1",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-open": "^2.0.0",
"gulp-replace": "^0.6.1",
"gulp-util": "~3.0.7",
"rimraf": "^2.6.2",
"vinyl-ftp": "~0.5.0"
},
"dependencies": {
"axios": "^0.16.2",
"classnames": "^2.2.5",
"gatsby": "^1.9.45",
"gatsby-link": "^1.6.17",
"gatsby-plugin-facebook-pixel": "^1.0.3",
"gatsby-plugin-google-analytics": "^1.0.10",
"gatsby-plugin-google-tagmanager": "^1.0.17",
"gatsby-plugin-react-helmet": "^1.0.5",
"gatsby-plugin-sass": "^1.0.12",
"gatsby-plugin-sitemap": "^1.2.5",
"gatsby-source-filesystem": "^1.5.35",
"gatsby-transformer-remark": "^1.7.40",
"js-cookie": "^2.2.0",
"prop-types": "^15.6.0",
"react-redux": "^5.0.6",
"redux-form": "^7.1.1",
"video-react": "^0.10.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment