link prefetching

This commit is contained in:
Joseph Montanaro
2021-10-19 08:53:03 -07:00
parent 481eac817e
commit 18e8883063
6 changed files with 25 additions and 24 deletions

View File

@@ -1,10 +1,18 @@
<script context="module">
export async function load({ page }) {
let post = await import(`./_posts/${page.params.slug}.svx`);
return {
props: {
meta: post.metadata,
body: post.default
try {
let post = await import(`./_posts/${page.params.slug}.svx`);
return {
props: {
meta: post.metadata,
body: post.default
}
}
}
catch (err) {
return {
status: 404,
error: `Not found: ${page.path}`,
}
}
}