forked from juliencrn/usehooks-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move google head tags to gatsby-ssr
- Loading branch information
Showing
4 changed files
with
41 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file. | ||
* | ||
* See: https://www.gatsbyjs.org/docs/ssr-apis/ | ||
*/ | ||
|
||
import React, { Fragment } from 'react' | ||
|
||
import { GatsbySSR } from 'gatsby' | ||
|
||
const GoogleAdsTag = ( | ||
<script | ||
key="google-ads" | ||
async | ||
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5817566022458684" | ||
crossOrigin="anonymous" | ||
/> | ||
) | ||
|
||
const GoogleFontTag = ( | ||
<Fragment key="google-fonts"> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link | ||
rel="preconnect" | ||
href="https://fonts.gstatic.com" | ||
crossOrigin="true" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400&family=Fira+Sans:wght@300;400;700&display=swap" | ||
rel="stylesheet" | ||
/> | ||
</Fragment> | ||
) | ||
|
||
export const onRenderBody: GatsbySSR['onRenderBody'] = props => { | ||
props.setHtmlAttributes({ lang: 'en' }) | ||
props.setHeadComponents([GoogleAdsTag, GoogleFontTag]) | ||
} | ||
|
||
export { default as wrapPageElement } from './src/libs/wrapPageElement' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters