Skip to content

Commit

Permalink
Merge pull request #229 from celestiaorg/hotfix/resolve-build-error
Browse files Browse the repository at this point in the history
Hotfix/resolve build error
  • Loading branch information
alex-beckett authored Jul 10, 2023
2 parents 804cad0 + 42396ce commit 00d4932
Show file tree
Hide file tree
Showing 5 changed files with 608 additions and 59 deletions.
12 changes: 11 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
description: `Celestia is a modular consensus and data network, built to enable anyone to easily deploy their own blockchain with minimal overhead.`,
author: `@CelestiaOrg`,
siteUrl: `https://celestia.org`,
// siteUrl: `https://dev.lazyledger.org`, <-- switch to this url for OG meta previews on https://dev.lazyledger.org
// siteUrl: `https://dev.lazyledger.org`, // <-- switch to this url for OG meta previews on https://dev.lazyledger.org
image: `/celestia-default-og-image.jpg`,
},

Expand Down Expand Up @@ -78,6 +78,16 @@ module.exports = {
},
},
"gatsby-plugin-react-helmet",
'gatsby-plugin-sitemap',
{
resolve: 'gatsby-plugin-robots-txt',
options: {
host: "https://dev.lazyledger.org",
sitemap: "https://dev.lazyledger.org/sitemap.xml",
output: "/robots.txt",
policy: [{ userAgent: '*', allow: '/' }]
}
},
{
resolve: `gatsby-transformer-remark`,
options: {
Expand Down
34 changes: 0 additions & 34 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -1,34 +0,0 @@
// Fix for Gatsby open graph meta tags are not recognized
// Reordering metatags at build time, priorising OG graph tags first.
// source: https://marcomelilli.com/posts/gatsby-react-helmet-og-meta-tags-are-not-recognized

const { Helmet } = require("react-helmet");

exports.onRenderBody = ({ setHeadComponents, setHtmlAttributes, setBodyAttributes }, pluginOptions) => {
const helmet = Helmet.renderStatic();
setHtmlAttributes(helmet.htmlAttributes.toComponent());
setBodyAttributes(helmet.bodyAttributes.toComponent());
setHeadComponents([
helmet.title.toComponent(),
helmet.link.toComponent(),
helmet.meta.toComponent(),
helmet.noscript.toComponent(),
helmet.script.toComponent(),
helmet.style.toComponent(),
]);
};

exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => {
const headComponents = getHeadComponents();

headComponents.sort((x, y) => {
if (x.props && x.props["data-react-helmet"]) {
return -1;
} else if (y.props && y.props["data-react-helmet"]) {
return 1;
}
return 0;
});

replaceHeadComponents(headComponents);
};
Loading

0 comments on commit 00d4932

Please sign in to comment.