<commit_before>// Packages
import Head from 'next/head'
import moment from 'moment'

// Other
import posts from '../data/essays'

// Components
import Title from './title'
import Back from './back'
import { Image } from './figure'

// Make date easily readable
const parseDate = date => moment(date, 'DD-MM-YYYY')

// Find post using its identifier
const findPost = id => posts.find(post => post.id === id)

export default ({ id, hasCover }) => {
  const post = findPost(id)
  const headingClass = hasCover ? 'has-cover' : ''
  const date = parseDate(post.date)

  let coverURL

  if (hasCover) {
    coverURL = `/static/essays/${date.format('YYYY')}/${id}/cover.png`
  }

  return (
    <aside>
      <Back to="/essays" outsideCover={hasCover} />

      {hasCover && <Image src={coverURL} isCover />}
      <Title value={post.title} />

      <h1 className={headingClass}>
        {post.title}
      </h1>
      <span>
        {date.format('MMMM Do YYYY')}
      </span>

      {post.title &&
        <Head>
          <meta name="twitter:title" content={post.title} />
        </Head>}

      {post.description &&
        <Head>
          <meta name="description" content={post.description} />
        </Head>}

      {hasCover &&
        <Head>
          <meta name="twitter:card" content="summary_large_image" />
          <meta name="twitter:image" content={'https://leo.im' + coverURL} />
        </Head>}

      <style jsx>
        {`
          h1 {
            font-weight: 500;
            margin: 0 0 8px 0;
            font-size: 24px;<commit_msg>Added description for Twitter cards<commit_after>// Packages
import Head from 'next/head'
import moment from 'moment'

// Other
import posts from '../data/essays'

// Components
import Title from './title'
import Back from './back'
import { Image } from './figure'

// Make date easily readable
const parseDate = date => moment(date, 'DD-MM-YYYY')

// Find post using its identifier
const findPost = id => posts.find(post => post.id === id)

export default ({ id, hasCover }) => {
  const post = findPost(id)
  const headingClass = hasCover ? 'has-cover' : ''
  const date = parseDate(post.date)

  let coverURL

  if (hasCover) {
    coverURL = `/static/essays/${date.format('YYYY')}/${id}/cover.png`
  }

  return (
    <aside>
      <Back to="/essays" outsideCover={hasCover} />

      {hasCover && <Image src={coverURL} isCover />}
      <Title value={post.title} />

      <h1 className={headingClass}>
        {post.title}
      </h1>
      <span>
        {date.format('MMMM Do YYYY')}
      </span>

      {post.title &&
        <Head>
          <meta name="twitter:title" content={post.title} />
        </Head>}

      {post.description &&
        <Head>
          <meta name="twitter:description" content={post.description} />
          <meta name="description" content={post.description} />
        </Head>}

      {hasCover &&
        <Head>
          <meta name="twitter:card" content="summary_large_image" />
          <meta name="twitter:image" content={'https://leo.im' + coverURL} />
        </Head>}

      <style jsx>
        {`
          h1 {
            font-weight: 500;
            margin: 0 0 8px 0;
            font-size: 24px;
{'fraction_non_alphanumeric': 0.15923963851667186, 'fraction_numerical': 0.00747896540978498, 'mean_word_length': 2.27217125382263, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 50, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3696600', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1000, 'n_words': 250}