---
import Layout from "../../layouts/Layout.astro";
import AllBlogs from "../../components/Blogs/index";

const BLOG_API_URL = "https://curriculum-app-api.beanstalkedu.com/items/blog";
let blogs = [];

try {
  const response = await fetch(`${BLOG_API_URL}?filter[status][_eq]=published&filter[property][_eq]=aKadmy`);
  const data = await response.json();
  blogs = data.data || [];
  console.log("Fetched blogs:", blogs[0].slug);
} catch (error) {
  console.error("Error fetching blogs:", error);
  blogs = [];
}
---
<Layout title="aKadmy Blogs | Insights, Tips, and Trends for Early Childhood" description={'Stay updated with the latest trends, insights, and tips on early childhood education. Explore aKadmy’s blog for valuable resources and expert advice.'} canonicalUrl={'https://akadmyapp.com/blogs'}>
  <AllBlogs client:only="react" />
</Layout>