Skip to content

Commit

Permalink
fixed unfounf window bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Holtz Yan authored and Holtz Yan committed Aug 29, 2023
1 parent a8a7083 commit 404f9ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/SEO.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
import React from 'react';
import { Script } from 'gatsby';

function getAdThriveScriptUrl(w) {
function getAdThriveScriptUrl() {
if (typeof window === 'undefined') {
return '';
}
const w = window;
w.adthrive = w.adthrive || {};
w.adthrive.cmd = w.adthrive.cmd || [];
w.adthrive.plugin = 'adthrive-ads-manual';
Expand Down Expand Up @@ -60,11 +64,7 @@ export const SEO = ({ title, seoDescription, keywords }) => {
name="twitter:image"
content="https://github.com/holtzy/The-Python-Graph-Gallery/blob/master/static/overview_PGG.png?raw=true"
/>
<Script
id="adthrive"
strategy="idle"
src={getAdThriveScriptUrl(window)}
/>
<Script id="adthrive" strategy="idle" src={getAdThriveScriptUrl()} />
</>
);
};

0 comments on commit 404f9ac

Please sign in to comment.