mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-13 03:25:24 +00:00
25 lines
573 B
HTML
25 lines
573 B
HTML
<svelte:head>
|
|
<title>Blog</title>
|
|
</svelte:head>
|
|
|
|
<h1>Recent posts</h1>
|
|
|
|
<ul>
|
|
{#each posts as post}
|
|
<!-- we're using the non-standard `rel=prefetch` attribute to
|
|
tell Sapper to load the data for the page as soon as
|
|
the user hovers over the link or taps it, instead of
|
|
waiting for the 'click' event -->
|
|
<li><a rel='prefetch' href='blog/{post.slug}'>{post.title}</a></li>
|
|
{/each}
|
|
</ul>
|
|
|
|
<script>
|
|
export default {
|
|
preload({ params, query }) {
|
|
return fetch(`blog.json`).then(r => r.json()).then(posts => {
|
|
return { posts };
|
|
});
|
|
}
|
|
};
|
|
</script> |