import type { MetadataRoute } from 'next';
import { getAllPosts } from '@/lib/mdx';

export default function sitemap(): MetadataRoute.Sitemap {
    const posts = getAllPosts();

    const blogEntries: MetadataRoute.Sitemap = posts.map((post) => ({
        url: `https://akkolli.net/blog/${post.slug}`,
        lastModified: new Date(post.date),
    }));

    return [
        { url: 'https://akkolli.net', lastModified: new Date() },
        { url: 'https://akkolli.net/blog', lastModified: new Date() },
        { url: 'https://akkolli.net/resume', lastModified: new Date() },
        ...blogEntries,
    ];
}
