blog server, page functions
This commit is contained in:
parent
a89f69c69c
commit
c7c2ea60a2
|
@ -1,7 +1,7 @@
|
|||
import { listPosts } from '$content/blog';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = async () => {
|
||||
return {
|
||||
posts: listPosts()
|
||||
};
|
||||
export const load = async ({ fetch }) => {
|
||||
const response = await fetch('api/posts');
|
||||
const posts: Post[] = await response.json();
|
||||
return { posts };
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { listPosts } from '$content/blog';
|
||||
import { listPosts } from '$lib/utils/blog';
|
||||
import RSS from 'rss';
|
||||
import type { Post } from '$lib/types/post';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { listProjects } from '$content/projects';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = () => {
|
||||
return {
|
||||
projects: listProjects()
|
||||
};
|
||||
export const load = async ({ fetch }) => {
|
||||
const response = await fetch('api/posts');
|
||||
const projects: Projects[] = await response.json();
|
||||
return { projects };
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getProject, listProjects } from '$content/projects';
|
||||
import { getProject, listProjects } from '$lib/utils/projects';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const entries = () => listProjects().map((post) => ({ slug: post.slug }));
|
||||
|
|
Loading…
Reference in New Issue