---
import { AppConfig } from '@/utils/AppConfig';
import Base from '@/layouts/Base.astro';
import Hero from '@/components/Hero.astro';
import LatestPosts from '@/components/LatestPosts.astro';
import { sortPostsByDate } from '@/utils/data.util';

const { title } = AppConfig;
const { description } = AppConfig;

const allPosts = await Astro.glob('./posts/*.md');
allPosts.sort(sortPostsByDate);
const latestPosts = allPosts.slice(0, 3);
---

<Base head={{ title, description }}>
	<Hero />
	<LatestPosts posts={latestPosts} />
</Base>
