| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- import NextDocument, {
- Html,
- Head,
- Main,
- NextScript,
- DocumentContext,
- } from 'next/document'
- import { dark, getCssString } from 'styles'
- import { GA_TRACKING_ID } from 'utils/gtag'
-
- class MyDocument extends NextDocument {
- static async getInitialProps(ctx: DocumentContext): Promise<{
- styles: JSX.Element
- html: string
- head?: JSX.Element[]
- }> {
- try {
- const initialProps = await NextDocument.getInitialProps(ctx)
-
- return {
- ...initialProps,
- styles: (
- <>
- {initialProps.styles}
- <style
- id="stitches"
- dangerouslySetInnerHTML={{ __html: getCssString() }}
- />
- </>
- ),
- }
- } catch (e) {
- console.error(e.message)
- } finally {
- null
- }
- }
-
- render(): JSX.Element {
- return (
- <Html lang="en">
- <Head>
- <link rel="manifest" href="/manifest.json" />
- <link rel="shortcut icon" href="/favicon.ico" />
- <meta name="application-name" content="tldraw" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <meta name="apple-mobile-web-app-title" content="tldraw" />
- <meta name="description" content="A tiny little drawing app." />
- <meta name="format-detection" content="telephone=no" />
- <meta name="mobile-web-app-capable" content="yes" />
- <meta name="theme-color" content="#fafafa" />
- <meta name="twitter:card" content="summary" />
- <meta name="twitter:url" content="https://tldraw.com" />
- <meta name="twitter:title" content="tldraw" />
- <meta
- name="twitter:description"
- content="A tiny little drawing app."
- />
- <meta name="twitter:creator" content="@steveruizok" />
- <meta property="og:type" content="website" />
- <meta property="og:title" content="tldraw" />
- <meta
- property="og:description"
- content="A tiny little drawing app."
- />
- <meta property="og:site_name" content="tldraw" />
- <meta property="og:url" content="https://tldraw.com" />
- <script
- async
- src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`}
- />
- <script
- dangerouslySetInnerHTML={{
- __html: `
- window.dataLayer = window.dataLayer || [];
- function gtag(){dataLayer.push(arguments);}
- gtag('js', new Date());
- gtag('config', '${GA_TRACKING_ID}', {
- page_path: window.location.pathname,
- });
- `,
- }}
- />
- </Head>
- <body className={dark}>
- <Main />
- <NextScript />
- </body>
- </Html>
- )
- }
- }
-
- export default MyDocument
|