switch to directly importing post, and install static adapter

This commit is contained in:
Joseph Montanaro
2021-10-18 15:54:45 -07:00
parent d0aaba7a7d
commit af6b065de8
9 changed files with 48 additions and 24 deletions

20
src/routes/index.svelte Normal file
View File

@ -0,0 +1,20 @@
<script context="module">
export async function load({ fetch }) {
const resp = await fetch('/all.json');
const allPosts = (await resp.json());
const post = await import(`./_posts/${allPosts[0].slug}.svx`);
return {
props: {
meta: post.metadata,
body: post.default,
}
}
}
</script>
<script>
import BlogPost from './[slug].svelte';
export let meta, body;
</script>
<BlogPost {meta} {body}></BlogPost>