Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

feat: load ads script on homepage only

AykutSarac4f1e13d1a753
diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx
index b5bd1874..7345c874 100644
--- a/src/pages/_document.tsx
+++ b/src/pages/_document.tsx
@@ -6,7 +6,6 @@ import Document, {
DocumentContext,
DocumentInitialProps,
} from "next/document";
-import Script from "next/script";
import { ServerStyleSheet } from "styled-components";
import { createGetInitialProps } from "@mantine/next";
import { SeoTags } from "src/components/SeoTags";
@@ -55,10 +54,6 @@ class MyDocument extends Document {
</Head>
<body>
<Main />
- <Script
- src="https://m.servedby-buysellads.com/monetization.js"
- strategy="beforeInteractive"
- />
<NextScript />
</body>
</Html>
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index ff413ce7..edd77934 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -2,6 +2,7 @@ import React from "react";
import dynamic from "next/dynamic";
import Head from "next/head";
import Link from "next/link";
+import Script from "next/script";
import styled, { ThemeProvider } from "styled-components";
import {
Anchor,
@@ -270,6 +271,8 @@ const HeroBottom = () => (
);
export const HomePage = () => {
+ const [ads, setAds] = React.useState(false);
+
return (
<ThemeProvider theme={lightTheme}>
<Head>
@@ -279,8 +282,9 @@ export const HomePage = () => {
<StatsBanner />
<FeaturesCards />
<HeroBottom />
- <HovercardAds />
<Footer />
+ {ads && <HovercardAds />}
+ <Script src="https://m.servedby-buysellads.com/monetization.js" onLoad={() => setAds(true)} />
</ThemeProvider>
);
};