feat: list subpages

This commit is contained in:
xieve
2025-09-10 11:29:42 +02:00
parent f61b472c68
commit 7b0dd84a25
3 changed files with 14 additions and 6 deletions

View File

@@ -1,9 +1,17 @@
<script>
let numbers = 0;
for (let i = 1; i < 10; i++) {
numbers++;
}
<script lang="ts">
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 SvelteComponent
]);
console.log(blog_entries);
</script>
<h1>Welcome to SvelteKit {numbers}</h1>
<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}>{href}</a><br />
{/each}