Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #163 from 30-seconds/static-xmls
Browse files Browse the repository at this point in the history
Fix XMLs injected with data-react-helmet

Fixes #162
  • Loading branch information
Chalarangelo authored Sep 6, 2020
2 parents 2e43bf8 + 444988b commit a3947aa
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 a3947aa

Please sign in to comment.