portet blog

This commit is contained in:
2020-09-23 15:37:12 +02:00
parent b447b99159
commit 4df5603222
17 changed files with 271 additions and 25 deletions

View File

@@ -41,7 +41,7 @@
<title>About</title>
</svelte:head>
<SimplePage title="About">
<SimplePage title="About" expanded={false}>
{@html data.content}
<img src="/images/about.jpg" alt="decoration" />
</SimplePage>

View File

@@ -0,0 +1,21 @@
<script context="module">
import { getOne } from '../../lib/wp'
export async function preload({ params }) {
const { slug } = params
const post = await getOne('posts', { slug })
return { post }
}
</script>
<script>
import SimplePage from '../../components/SimplePage.svelte'
import WPAdapter from '../../components/WPAdapter.svelte'
import PostAttributes from '../../components/PostAttributes.svelte'
export let post
</script>
<SimplePage title={post.title} expanded={false} readable>
<PostAttributes {post} full />
<WPAdapter content={post.content} />
</SimplePage>

View File

@@ -0,0 +1,25 @@
<script context="module">
import { getAll } from '../../lib/wp'
export async function preload() {
const data = await getAll('posts')
return { data }
}
</script>
<script>
import SimplePage from '../../components/SimplePage.svelte'
import PostPreview from '../../components/PostPreview.svelte'
export let data
</script>
<svelte:head>
<title>Blog</title>
</svelte:head>
<SimplePage title="Blog">
{#each data as post}
<PostPreview {post} />
{/each}
</SimplePage>