123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import Document, {
- Html,
- Head,
- Main,
- NextScript,
- DocumentContext,
- DocumentInitialProps,
- } from "next/document";
- import { SeoTags } from "src/components/SeoTags";
- import { ServerStyleSheet } from "styled-components";
- class MyDocument extends Document {
- static async getInitialProps(
- ctx: DocumentContext
- ): Promise<DocumentInitialProps> {
- const sheet = new ServerStyleSheet();
- const originalRenderPage = ctx.renderPage;
- try {
- ctx.renderPage = () =>
- originalRenderPage({
- enhanceApp: (App) => (props) =>
- sheet.collectStyles(<App {...props} />),
- });
- const initialProps = await Document.getInitialProps(ctx);
- return {
- ...initialProps,
- styles: [initialProps.styles, sheet.getStyleElement()],
- };
- } finally {
- sheet.seal();
- }
- }
- render() {
- return (
- <Html lang="en">
- <Head>
- <SeoTags
- description="Simple visualization tool for your JSON data. No forced structure, paste your JSON and view it instantly."
- title="JSON Visio - Directly onto graphs"
- image="https://jsonvisio.com/jsonvisio.png"
- />
- <meta name="theme-color" content="#36393E" />
- <link rel="manifest" href="/manifest.json" />
- <link rel="icon" href="/favicon.ico" />
- <link rel="preconnect" href="https://fonts.googleapis.com" />
- <link
- rel="preconnect"
- href="https://fonts.gstatic.com"
- crossOrigin="anonymous"
- />
- <link
- href="https://fonts.googleapis.com/css2?family=Catamaran:wght@400;500;700&family=Roboto+Mono:wght@500&family=Roboto:wght@400;500;700&display=swap"
- rel="stylesheet"
- crossOrigin="anonymous"
- />
- </Head>
- <body>
- <Main />
- <NextScript />
- </body>
- </Html>
- );
- }
- }
- export default MyDocument;
|