import { NextPageContext } from 'next' import Head from 'next/head' import Link from 'next/link' import emoji from 'node-emoji' import { Component } from 'react' import ReactMarkdown from 'react-markdown/with-html' import Post from '../../components/Post' import config from '../../config' import Error from '../_error' interface Props { post: Post } interface States { imgHeight: number } export default class PostPage extends Component { public static async getInitialProps(context: NextPageContext) { const { slug } = context.query if (typeof slug === 'object' || slug === '[slug]') { return {post: undefined} } const post = new Post(slug) await post.fetch() return {post} } public render() { return (
{`${this.props.post.title} - ${config.og.title}`} {this.props.post.header.image ? ( ) : undefined} {this.props.post === undefined ? ( ) : (
{this.props.post.header.imageAlt} `${code}`)}/>

Détails

Tags:

    {this.props.post.header.tags.map((el) => (
  • {el}
  • ))}
{this.props.post.header.url ? ( Visiter le site :D ) : undefined}
)}
) } }