Skip to content

Commit

Permalink
Fix XMLs injected with data-react-helmet
Browse files Browse the repository at this point in the history
  • Loading branch information
Chalarangelo committed Sep 6, 2020
1 parent 2e43bf8 commit 444988b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
30 changes: 29 additions & 1 deletion gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
/*
Gatsby SSR API
*/
export { default as wrapRootElement } from 'state/ReduxWrapper';
import ReduxWrapper from 'state/ReduxWrapper';
import React from 'react';

/**
* Wraps the whole application in a redux Provider.
*/
export const wrapRootElement = ReduxWrapper;

/**
* Called after rendering a page. Injects sitemap and opensearch XMLs.
* TODO: Improve and extract outside of this file, if/when possible.
*/
export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<link
key="link-sitemap"
rel="sitemap"
href="/sitemap.xml"
type="application/xml"
/>,
<link
key="link-opensearch"
rel="search"
href="/opensearch.xml"
type="application/opensearchdescription+xml"
title="Snippet search"
/>,
]);
};
11 changes: 0 additions & 11 deletions src/components/organisms/meta/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,6 @@ const Meta = ({
key="preconnect-google-analytics"
href="https://www.google-analytics.com"
/>
<link
rel="sitemap"
href="/sitemap.xml"
type="application/xml"
/>
<link
rel="search"
href="/opensearch.xml"
type="application/opensearchdescription+xml"
title="Snippet search"
/>
{
canonical ?
<link
Expand Down

0 comments on commit 444988b

Please sign in to comment.