Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

_document.tsx 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import NextDocument, {
  2. Html,
  3. Head,
  4. Main,
  5. NextScript,
  6. DocumentContext,
  7. } from 'next/document'
  8. import { dark, getCssString } from 'styles'
  9. import { GA_TRACKING_ID } from 'utils/gtag'
  10. class MyDocument extends NextDocument {
  11. static async getInitialProps(ctx: DocumentContext): Promise<{
  12. styles: JSX.Element
  13. html: string
  14. head?: JSX.Element[]
  15. }> {
  16. try {
  17. const initialProps = await NextDocument.getInitialProps(ctx)
  18. return {
  19. ...initialProps,
  20. styles: (
  21. <>
  22. {initialProps.styles}
  23. <style
  24. id="stitches"
  25. dangerouslySetInnerHTML={{ __html: getCssString() }}
  26. />
  27. </>
  28. ),
  29. }
  30. } catch (e) {
  31. console.error(e.message)
  32. } finally {
  33. null
  34. }
  35. }
  36. render(): JSX.Element {
  37. return (
  38. <Html lang="en">
  39. <Head>
  40. <link rel="manifest" href="/manifest.json" />
  41. <link rel="shortcut icon" href="/favicon.ico" />
  42. <meta name="application-name" content="tldraw" />
  43. <meta name="apple-mobile-web-app-capable" content="yes" />
  44. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  45. <meta name="apple-mobile-web-app-title" content="tldraw" />
  46. <meta name="description" content="A tiny little drawing app." />
  47. <meta name="format-detection" content="telephone=no" />
  48. <meta name="mobile-web-app-capable" content="yes" />
  49. <meta name="theme-color" content="#fafafa" />
  50. <meta name="twitter:card" content="summary" />
  51. <meta name="twitter:url" content="https://tldraw.com" />
  52. <meta name="twitter:title" content="tldraw" />
  53. <meta
  54. name="twitter:description"
  55. content="A tiny little drawing app."
  56. />
  57. <meta name="twitter:creator" content="@steveruizok" />
  58. <meta property="og:type" content="website" />
  59. <meta property="og:title" content="tldraw" />
  60. <meta
  61. property="og:description"
  62. content="A tiny little drawing app."
  63. />
  64. <meta property="og:site_name" content="tldraw" />
  65. <meta property="og:url" content="https://tldraw.com" />
  66. <script
  67. async
  68. src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`}
  69. />
  70. <script
  71. dangerouslySetInnerHTML={{
  72. __html: `
  73. window.dataLayer = window.dataLayer || [];
  74. function gtag(){dataLayer.push(arguments);}
  75. gtag('js', new Date());
  76. gtag('config', '${GA_TRACKING_ID}', {
  77. page_path: window.location.pathname,
  78. });
  79. `,
  80. }}
  81. />
  82. </Head>
  83. <body className={dark}>
  84. <Main />
  85. <NextScript />
  86. </body>
  87. </Html>
  88. )
  89. }
  90. }
  91. export default MyDocument