<commit_before>import Document, { Head, Main, NextScript } from 'next/document'
import { ServerStyleSheet } from 'styled-components'
import guidebook from '../guidebook'

export default class MyDocument extends Document {
  static async getInitialProps(ctx) {
    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>
        <Head lang="en">
          {/* Favicon */}
          <link rel="icon" type="image/x-icon" href="/static/favicon.ico" />
          <link rel="icon" type="image/png" href="/static/favicon.png" />

          {/* Site description */}
          <meta name="description" content={guidebook.subtitle} />
          <meta name="twitter:card" content="summary"></meta>
          <meta name="twitter:creator" content="@dvnabbott" />
          <meta property="og:type" content="article" />
          <meta property="og:url" content="https://www.reactnative.express/" />
          <meta property="og:site_name" content={guidebook.title} />
          <meta property="og:description" content={guidebook.subtitle} />
          <meta property="og:locale" content="en_US" />
          <meta property="og:card" content="summary" />
          <meta property="og:creator" content="@dvnabbott" />
          <meta
            property="article:author"
            content="https://twitter.com/dvnabbott"
          />

          {/* Image */}
          <meta
            property="og:image"
            content="http://www.reactnative.express/static/preview.png"
          />
          <meta
            property="og:image:secure_url"
            content="https://www.reactnative.express/static/preview.png"
          />
          <meta property="og:image:type" content="image/png" />
          <meta property="og:image:width" content="1200" />
          <meta property="og:image:height" content="630" />
          <meta property="og:image:alt" content="" />

          {/* Facebook */}
          <meta property="fb:app_id" content="907755649360812" />

          {/* Step 5: Output the styles in the head  */}
          {this.props.styleTags}
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
      </html>
    )
  }
}
<commit_msg>Add twitter:image meta tag<commit_after>import Document, { Head, Main, NextScript } from 'next/document'
import { ServerStyleSheet } from 'styled-components'
import guidebook from '../guidebook'

export default class MyDocument extends Document {
  static async getInitialProps(ctx) {
    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>
        <Head lang="en">
          {/* Favicon */}
          <link rel="icon" type="image/x-icon" href="/static/favicon.ico" />
          <link rel="icon" type="image/png" href="/static/favicon.png" />

          {/* Site description */}
          <meta name="description" content={guidebook.subtitle} />
          <meta property="og:type" content="article" />
          <meta property="og:url" content="https://www.reactnative.express/" />
          <meta property="og:site_name" content={guidebook.title} />
          <meta property="og:description" content={guidebook.subtitle} />
          <meta property="og:locale" content="en_US" />
          <meta property="og:card" content="summary" />
          <meta property="og:creator" content="@dvnabbott" />
          <meta
            property="article:author"
            content="https://twitter.com/dvnabbott"
          />

          {/* Image */}
          <meta
            property="og:image"
            content="http://www.reactnative.express/static/preview.png"
          />
          <meta
            property="og:image:secure_url"
            content="https://www.reactnative.express/static/preview.png"
          />
          <meta property="og:image:type" content="image/png" />
          <meta property="og:image:width" content="1200" />
          <meta property="og:image:height" content="630" />
          <meta property="og:image:alt" content="" />

          {/* Twitter */}
          <meta name="twitter:card" content="summary"></meta>
          <meta name="twitter:creator" content="@dvnabbott" />
          <meta
            name="twitter:image"
            content="https://www.reactnative.express/static/preview.png"
          />

          {/* Facebook */}
          <meta property="fb:app_id" content="907755649360812" />

          {/* Step 5: Output the styles in the head  */}
          {this.props.styleTags}
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
      </html>
    )
  }
}

{'fraction_non_alphanumeric': 0.15278524090990506, 'fraction_numerical': 0.008239297868529465, 'mean_word_length': 1.976545842217484, 'pattern_counts': {'":': 0, '<': 68, '<?xml version=': 0, '>': 74, 'https://': 7, 'lorem ipsum': 0, 'www.': 7, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3697302', 'n_tokens_mistral': 1627, 'n_tokens_neox': 1566, 'n_words': 281}