mirror of
https://github.com/cupcakearmy/nicco.io.git
synced 2025-12-16 02:35:09 +00:00
progress
This commit is contained in:
32
src/routes/blog/[slug].svelte
Normal file
32
src/routes/blog/[slug].svelte
Normal file
@@ -0,0 +1,32 @@
|
||||
<script lang="ts" context="module">
|
||||
import type { Load } from '@sveltejs/kit'
|
||||
|
||||
export const prerender = true
|
||||
export const load: Load = async ({ fetch, page }) => {
|
||||
return {
|
||||
props: {
|
||||
data: await fetch(`/api/posts/${page.params.slug}.json`).then((r) => r.json()),
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type { Post } from '$lib/api'
|
||||
import SimplePage from '$lib/components/SimplePage.svelte'
|
||||
import PostAttributes from '$lib/components/PostAttributes.svelte'
|
||||
import WpAdapter from '$lib/components/WPAdapter.svelte'
|
||||
|
||||
export let data: Post
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Works</title>
|
||||
</svelte:head>
|
||||
|
||||
<SimplePage title={data.title}>
|
||||
<PostAttributes post={data} full />
|
||||
{#if data.content}
|
||||
<WpAdapter content={data.content} />
|
||||
{/if}
|
||||
</SimplePage>
|
||||
30
src/routes/blog/index.svelte
Normal file
30
src/routes/blog/index.svelte
Normal file
@@ -0,0 +1,30 @@
|
||||
<script lang="ts" context="module">
|
||||
import type { Load } from '@sveltejs/kit'
|
||||
|
||||
export const prerender = true
|
||||
export const load: Load = async ({ fetch }) => {
|
||||
return {
|
||||
props: {
|
||||
data: await fetch('/api/posts/*.json').then((r) => r.json()),
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type { Post } from '$lib/api'
|
||||
import SimplePage from '$lib/components/SimplePage.svelte'
|
||||
import PostPreview from '$lib/components/PostPreview.svelte'
|
||||
|
||||
export let data: Post[]
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Blog</title>
|
||||
</svelte:head>
|
||||
|
||||
<SimplePage title="Works">
|
||||
{#each data as post}
|
||||
<PostPreview {post} />
|
||||
{/each}
|
||||
</SimplePage>
|
||||
Reference in New Issue
Block a user