feat: added blog posts using notion

This commit is contained in:
Bart van der Braak 2023-08-02 03:43:44 +02:00
parent 270de8c976
commit 44b7ca6ab5
6 changed files with 33 additions and 11 deletions

View file

@ -27,11 +27,20 @@
});
}
import { initNotion } from "sveltekit-notion-blog";
export const prerender = true;
initNotion({
databaseId: import.meta.env.PUBLIC_NOTION_DATABASE_ID,
notionToken: import.meta.env.PUBLIC_NOTION_TOKEN,
});
let routes = [
{ url: '/', label: 'Home' },
{ url: '/projects', label: 'Projects' },
{ url: '/tools', label: 'Tools' }
// { url: '/blog', label: 'Blog' }
{ url: '/tools', label: 'Tools' },
{ url: '/blog', label: 'Blog' },
];
let progress = 0;

View file

@ -0,0 +1,3 @@
import type { PageServerLoad } from './$types';
import { getAllPosts } from "sveltekit-notion-blog";
export const load: PageServerLoad = () => getAllPosts();

View file

@ -1,7 +1,16 @@
<script lang="ts">
import type { PageData } from './$types';
import { PostsList } from "sveltekit-notion-blog";
export let data: PageData;
</script>
<svelte:head>
<title>hellob.art &mdash; blog</title>
</svelte:head>
<main class="container mx-auto px-4 py-8 text-left">
<h2 class="text-3xl font-bold mb-8">Blog posts</h2>
<div class="max-w-4xl m-auto">
<PostsList {data} />
</div>
</main>

View file

View file

@ -0,0 +1,4 @@
import type { ServerLoadEvent } from '@sveltejs/kit';
import { getBlogPageBySlug } from 'sveltekit-notion-blog';
export const load = (event: ServerLoadEvent) => getBlogPageBySlug(event);

View file

@ -1,11 +1,8 @@
<script>
/** @type {import('./$types').PageData} */
export let data;
<script lang="ts">
import { BlogPost } from 'sveltekit-notion-blog';
import type { PageData } from './$types';
export let data: PageData;
</script>
<svelte:head>
<title>hellob.art &mdash; {data.title}</title>
</svelte:head>
<!-- <h1>{data.title}</h1>
<div>{@html data.content}</div> -->
<BlogPost {data} />