page.js 781 Bytes
import SingleBlog from "@components/top-level/single-blog";
import { getPostById } from "@lib/posts";

const SingleBlogApp = ({ params }) => {
  let blog;
  const fetchBlogsBySlug = () => {
    try {
      console.log("sdkjfh", params.id);
      const blogPost = getPostById("posts", params.id);
      blog = blogPost[0];
      console.log("fjh", blog);
    } catch (err) {
      console.log("error", err.message);
    }
  };
  fetchBlogsBySlug();
  return (
    <SingleBlog
      title={blog.title}
      publishedDate={blog.publishedDate}
      author={blog.author}
      category={blog.category}
      blogImage={blog.blogImage}
      readingTime={blog.readingTime}
      categories={blog.categories}
      markdown={blog.markdown}
    />
  );
};

export default SingleBlogApp;