forked from LaconicNetwork/icns-frontend
171 lines
4.9 KiB
TypeScript
171 lines
4.9 KiB
TypeScript
import Document, {
|
|
DocumentContext,
|
|
Html,
|
|
Head,
|
|
Main,
|
|
NextScript,
|
|
} from "next/document";
|
|
import { ServerStyleSheet } from "styled-components";
|
|
|
|
class MyDocument extends Document {
|
|
static async getInitialProps(ctx: DocumentContext) {
|
|
const sheet = new ServerStyleSheet();
|
|
const originalRenderPage = ctx.renderPage;
|
|
|
|
try {
|
|
// Run the React rendering logic synchronously
|
|
ctx.renderPage = () =>
|
|
originalRenderPage({
|
|
// Useful for wrapping the whole react tree
|
|
enhanceApp: (App) => (props) =>
|
|
sheet.collectStyles(<App {...props} />),
|
|
// Useful for wrapping in a per-page basis
|
|
enhanceComponent: (Component) => Component,
|
|
});
|
|
|
|
// Run the parent `getInitialProps`, it now includes the custom `renderPage`
|
|
const initialProps = await Document.getInitialProps(ctx);
|
|
|
|
return {
|
|
...initialProps,
|
|
styles: (
|
|
<div>
|
|
{initialProps.styles}
|
|
{sheet.getStyleElement()}
|
|
</div>
|
|
),
|
|
};
|
|
} finally {
|
|
sheet.seal();
|
|
}
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Html>
|
|
<Head>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
<link
|
|
rel="preconnect"
|
|
href="https://fonts.gstatic.com"
|
|
crossOrigin="use-credentials"
|
|
/>
|
|
<link
|
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
|
|
rel="stylesheet"
|
|
/>
|
|
<meta content="Interchain Name Service" property="og:title" />
|
|
<meta content="Interchain Name Service" name="twitter:title" />
|
|
<meta
|
|
content="Your identity for the Interchain. Claim yours today."
|
|
property="og:description"
|
|
/>
|
|
<meta
|
|
content="Your identity for the Interchain. Claim yours today."
|
|
property="twitter:description"
|
|
/>
|
|
<meta
|
|
name="viewport"
|
|
content="initial-scale=1.0, width=device-width"
|
|
/>
|
|
<meta
|
|
content={`https://app.icns.xyz/images/og-image.jpg`}
|
|
name="twitter:image"
|
|
/>
|
|
<meta content={`ICNS image`} name="twitter:image:alt" />
|
|
<meta
|
|
content={`https://app.icns.xyz/images/og-image.jpg`}
|
|
property="og:image"
|
|
/>
|
|
<meta content="summary_large_image" name="twitter:card" />
|
|
<meta property="og:type" content="website" />
|
|
|
|
{/* generated favicons */}
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="57x57"
|
|
href="/images/favicon/apple-icon-57x57.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="60x60"
|
|
href="/images/favicon/apple-icon-60x60.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="72x72"
|
|
href="/images/favicon/apple-icon-72x72.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="76x76"
|
|
href="/images/favicon/apple-icon-76x76.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="114x114"
|
|
href="/images/favicon/apple-icon-114x114.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="120x120"
|
|
href="/images/favicon/apple-icon-120x120.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="144x144"
|
|
href="/images/favicon/apple-icon-144x144.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="152x152"
|
|
href="/images/favicon/apple-icon-152x152.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="180x180"
|
|
href="/images/favicon/apple-icon-180x180.png"
|
|
/>
|
|
<link
|
|
rel="icon"
|
|
type="image/png"
|
|
sizes="192x192"
|
|
href="/images/favicon/android-icon-192x192.png"
|
|
/>
|
|
<link
|
|
rel="icon"
|
|
type="image/png"
|
|
sizes="32x32"
|
|
href="/images/favicon/favicon-32x32.png"
|
|
/>
|
|
<link
|
|
rel="icon"
|
|
type="image/png"
|
|
sizes="96x96"
|
|
href="/images/favicon/favicon-96x96.png"
|
|
/>
|
|
<link
|
|
rel="icon"
|
|
type="image/png"
|
|
sizes="16x16"
|
|
href="/images/favicon/favicon-16x16.png"
|
|
/>
|
|
<link rel="manifest" href="/images/favicon/manifest.json" />
|
|
<meta name="msapplication-TileColor" content="#ffffff" />
|
|
<meta
|
|
name="msapplication-TileImage"
|
|
content="/images/favicon/ms-icon-144x144.png"
|
|
/>
|
|
<meta name="theme-color" content="#ffffff" />
|
|
</Head>
|
|
<body>
|
|
<Main />
|
|
<NextScript />
|
|
</body>
|
|
</Html>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default MyDocument;
|