_document.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import React from 'react';
  2. import Document, { Head, Main, NextScript } from 'next/document';
  3. import { ServerStyleSheet } from 'styled-components';
  4. const style = {
  5. margin: 0,
  6. backgroundColor: '#f3f3f3',
  7. font: '16px/1.45 "Nunito", sans-serif',
  8. overflowX: 'hidden',
  9. color: 'black',
  10. };
  11. class AppDocument extends Document {
  12. static getInitialProps({ renderPage }) {
  13. const sheet = new ServerStyleSheet();
  14. const page = renderPage(App => props => sheet.collectStyles(<App {...props} />));
  15. const styleTags = sheet.getStyleElement();
  16. return { ...page, styleTags };
  17. }
  18. render() {
  19. return (
  20. <html lang="en">
  21. <Head>
  22. <meta charSet="utf-8" />
  23. <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
  24. <title>Kutt.it | Modern URL shortener.</title>
  25. <meta
  26. name="description"
  27. content="Kutt.it is a free and open source URL shortener with custom domains and stats."
  28. />
  29. <link
  30. href="https://fonts.googleapis.com/css?family=Nunito:300,400,700"
  31. rel="stylesheet"
  32. />
  33. <link rel="icon" sizes="196x196" href="/images/favicon-196x196.png" />
  34. <link rel="icon" sizes="32x32" href="/images/favicon-32x32.png" />
  35. <link rel="icon" sizes="16x16" href="/images/favicon-16x16.png" />
  36. <link rel="apple-touch-icon" href="/images/favicon-196x196.png" />
  37. <link rel="mask-icon" href="/images/icon.svg" color="blue" />
  38. <meta property="fb:app_id" content="123456789" />
  39. <meta property="og:url" content="https://kutt.it" />
  40. <meta property="og:type" content="website" />
  41. <meta property="og:title" content="Kutt.it" />
  42. <meta property="og:image" content="https://kutt.it/card.png" />
  43. <meta property="og:description" content="Free Modern URL Shortener" />
  44. <meta name="twitter:url" content="https://kutt.it" />
  45. <meta name="twitter:title" content="Kutt.it" />
  46. <meta name="twitter:description" content="Free Modern URL Shortener" />
  47. <meta name="twitter:image" content="https://kutt.it/card.png" />
  48. {this.props.styleTags}
  49. <script src="https://www.google.com/recaptcha/api.js?render=explicit" />
  50. <script src="/analytics.js" />
  51. </Head>
  52. <body style={style}>
  53. <Main />
  54. <NextScript />
  55. </body>
  56. </html>
  57. );
  58. }
  59. }
  60. export default AppDocument;