import BlogData from "@comp/Blog/BlogData/page";
import React from "react";

async function getData(id) {
  const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/blog/${id}`);
  const post = await res.json();
  return post;
}

const page = async ({ params }) => {
  const data = await getData(params.id[0]);

  console.log(data);

  // const structuredData = {
  //   "@context": "https://schema.org",
  //   "@type": "BlogPosting",
  //   headline: "This is a cool blog post",
  //   image: ["small.webp", "large.webp"],
  //   datePublished: "2024-02-15T00:00:00",
  //   dateModified: "2025-02-15T00:00:00",
  //   author: [
  //     {
  //       "@type": "Person",
  //       name: "Firstname LastName",
  //       jobTitle: "Blog post writer",
  //       worksFor: "Blog post company",
  //       url: `${process.env.NEXT_PUBLIC_SITE_URL}/people/firstname-lastname`,
  //       image: `${process.env.NEXT_PUBLIC_SITE_URL}/people/f_lastname.webp`,
  //     },
  //   ],
  //   description: "There are things in this post. Don't be vague like me",
  // };

  return <BlogData data={data} />;
};

export default page;
