import { NextPageContext } from "next" import{ Component } from 'react' import Post from "../../components/Post" import ReactMarkdown from 'react-markdown' import Error from "../_error" import Link from "next/link" import Head from "next/head" import config from "../../config" interface Props { post: Post } interface States { imgHeight: number } export default class PostPage extends Component { 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}

Détails

Tags:

    {this.props.post.header.tags.map((el) => (
  • {el}
  • ))}
{this.props.post.header.url ? ( Visiter le site :D ) : undefined}
)}
) } 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} } }