_document.js 2.7 KB

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