switch to directly importing post, and install static adapter
This commit is contained in:
20
src/routes/index.svelte
Normal file
20
src/routes/index.svelte
Normal 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>
|
Reference in New Issue
Block a user