Skip to content

Commit

Permalink
drop scripts in _document
Browse files Browse the repository at this point in the history
  • Loading branch information
laubsauger committed May 3, 2024
1 parent d7e8f00 commit 1c231c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
12 changes: 0 additions & 12 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import type { NextPage } from 'next'
import type { ReactElement, ReactNode } from 'react'
import type { AppProps } from 'next/app'
import { GoogleTagManager } from '@next/third-parties/google'

import Head from 'next/head'
import Router from 'next/router'
import nProgress from 'nprogress'
import 'nprogress/nprogress.css'
import 'src/theme/base.css'
import 'src/theme/global.css'
import Script from 'next/script';
type NextPageWithLayout = NextPage & {
getLayout?: (page: ReactElement) => ReactNode
}
Expand Down Expand Up @@ -38,16 +36,6 @@ function EdenApp(props: EdenAppProps) {
</Head>
<main>
{getLayout(<Component {...pageProps} />)}
<Script
src="https://rum-static.pingdom.net/pa-662f1da168cac40012000a8e.js"
strategy="lazyOnload"
onLoad={() =>
console.log(`script loaded: https://rum-static.pingdom.net/pa-662f1da168cac40012000a8e.js`)
}
/>
{process.env.NODE_ENV === 'production' ? (
<GoogleTagManager gtmId="G-W4718WCZQK" />
) : null}
</main>
</>
)
Expand Down
16 changes: 16 additions & 0 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as React from 'react'

import Document, { Html, Head, Main, NextScript } from 'next/document'
import { ServerStyleSheet } from 'styled-components'
import { GoogleTagManager } from '@next/third-parties/google';
import Script from 'next/script';

export default class MyDocument extends Document {
static async getInitialProps(ctx) {
Expand Down Expand Up @@ -45,8 +47,12 @@ export default class MyDocument extends Document {
sizes="16x16"
href="/favicon-16x16.png"
/>

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
{process.env.NODE_ENV === 'production' ? (
<link rel="preconnect" href="https://www.googletagmanager.com" />
) : null}
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400&display=swap"
Expand All @@ -55,6 +61,16 @@ export default class MyDocument extends Document {
<body>
<Main />
<NextScript />
{process.env.NODE_ENV === 'production' ? (
<GoogleTagManager gtmId="G-W4718WCZQK" />
) : null}
<Script
src="https://rum-static.pingdom.net/pa-662f1da168cac40012000a8e.js"
strategy="lazyOnload"
onLoad={() =>
console.log(`script loaded: https://rum-static.pingdom.net/pa-662f1da168cac40012000a8e.js`)
}
/>
</body>
</Html>
)
Expand Down

0 comments on commit 1c231c0

Please sign in to comment.