mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
34 lines
527 B
Svelte
34 lines
527 B
Svelte
<script context="module">
|
|
export function preload({ params, query }) {
|
|
return this.fetch(`blog.json`)
|
|
.then(r => r.json())
|
|
.then(posts => {
|
|
return { posts };
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
export let posts;
|
|
</script>
|
|
|
|
<style>
|
|
ul {
|
|
margin: 0 0 1em 0;
|
|
line-height: 1.5;
|
|
}
|
|
</style>
|
|
|
|
<svelte:head>
|
|
<title>Blog</title>
|
|
</svelte:head>
|
|
|
|
<h1>Recent posts</h1>
|
|
|
|
<ul>
|
|
{#each posts as post}
|
|
<li>
|
|
<a rel="prefetch" href="blog/{post.slug}">{post.title}</a>
|
|
</li>
|
|
{/each}
|
|
</ul>
|