<script lang="ts">
	import type { MDsveXComponent } from '$lib/types';
	import type { SvelteComponent } from 'svelte';

	const blog_entries: [string, SvelteComponent][] = Object.entries(
		import.meta.glob('/src/routes/blogs/**/+page.svx', { eager: true })
	).map(([key, value]) => [
		key.split('/src/routes').pop()?.split('/+page.svx').slice(0, -1).pop() as string,
		value as MDsveXComponent
	]);
	console.log(blog_entries);
</script>

<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
{#each blog_entries as [href, page]}
	<a {href}>{page.metadata?.title}</a><br />
	<svelte:component this={page.default} />
{/each}
