Skip to content

Commit

Permalink
Add cover image in post detail page
Browse files Browse the repository at this point in the history
  • Loading branch information
mojib2014 committed Jan 26, 2022
1 parent b6ead7b commit 92035ea
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pages/blog/posts/[...slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Layout from "components/Layout";
import { getPostBySlug, getAllPosts } from "lib/api/api";
import { CMS_NAME } from "lib/api/constants";
import SubNav from "components/common/SubNav";
import Image from "next/image";

export default function Post({ post, morePosts, preview }) {
const router = useRouter();
Expand All @@ -23,6 +24,16 @@ export default function Post({ post, morePosts, preview }) {
<h1 className="text-center font-bold text-5xl mt-6 mb-16">
{post.title}
</h1>
<div className="w-[700px] h-[auto] max-h-[500px] my-5 mx-auto">
<Image
src={post.coverImage}
alt={post.title}
width={700}
height={300}
layout="responsive"
objectFit="cover"
/>
</div>
<div dangerouslySetInnerHTML={{ __html: post.content }} />
</div>
</div>
Expand Down

1 comment on commit 92035ea

@vercel
Copy link

@vercel vercel bot commented on 92035ea Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.