import Layout from '../../components/layout'; import { useRouter } from 'next/router'; import { getAllPosts, getPost } from '../../lib/slug'; import ReactMarkdown from 'react-markdown'; import Image from 'next/image'; function Post({post} : any) { // eh const router = useRouter(); return (
{post.cover ? {`${post.title} : ''} {post.content}
); } export async function getStaticProps({params}: any) { const post = getPost(params.page); return { props: {post} }; } export async function getStaticPaths() { const posts = getAllPosts(); return { paths: posts.map(post => { return { params: { page: post.slug } } }), fallback: false }; } export default Post;