Skip to content

Commit

Permalink
DOP-2077: add robots meta to Helmet (#754)
Browse files Browse the repository at this point in the history
add robots meta to dynamic header render
  • Loading branch information
seungpark authored Jan 23, 2023
1 parent 1a4f63e commit ee5f00e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 7 additions & 0 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ThemeProvider } from '@emotion/react';
import { renderStylesToString } from '@leafygreen-ui/emotion';
import LeafyGreenProvider from '@leafygreen-ui/leafygreen-provider';
import { renderToString } from 'react-dom/server';
import { Helmet } from 'react-helmet';
import { theme } from './src/theme/docsTheme';

export const onRenderBody = ({ setHeadComponents }) => {
Expand All @@ -23,6 +24,12 @@ export const onRenderBody = ({ setHeadComponents }) => {
__html: `!function(e,t,r,n){if(!e[n]){for(var a=e[n]=[],i=["survey","reset","config","init","set","get","event","identify","track","page","screen","group","alias"],s=0;s<i.length;s++){var c=i[s];a[c]=a[c]||function(e){return function(){var t=Array.prototype.slice.call(arguments);a.push([e,t])}}(c)}a.SNIPPET_VERSION="1.0.1";var o=t.createElement("script");o.type="text/javascript",o.async=!0,o.src="https://d2yyd1h5u9mauk.cloudfront.net/integrations/web/v1/library/"+r+"/"+n+".js";var l=t.getElementsByTagName("script")[0];l.parentNode.insertBefore(o,l)}}(window,document,"Dk30CC86ba0nATlK","delighted");`,
}}
/>,
// Set meta on SSR here.
// Add dynamic meta, required on page render.
// React Helmet will override with any nested/latter tags from SSR'ed components.
<Helmet>
<meta name="robots" content="index"></meta>
</Helmet>,
]);
};

Expand Down
1 change: 0 additions & 1 deletion src/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const HTML = ({ body, bodyAttributes, headComponents, htmlAttributes, preBodyCom
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta httpEquiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index" />
<meta name="release" content="1.0" />
<meta name="version" content="master" />
<meta property="og:image" content={metaUrl} />
Expand Down

0 comments on commit ee5f00e

Please sign in to comment.