blog server, page functions
This commit is contained in:
parent
a89f69c69c
commit
c7c2ea60a2
|
@ -1,2 +1,2 @@
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
export const trailingSlash = 'never';
|
export const trailingSlash = 'never';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { listPosts } from '$content/blog';
|
import type { PageLoad } from './$types';
|
||||||
|
|
||||||
export const load = async () => {
|
export const load = async ({ fetch }) => {
|
||||||
return {
|
const response = await fetch('api/posts');
|
||||||
posts: listPosts()
|
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 RSS from 'rss';
|
||||||
import type { Post } from '$lib/types/post';
|
import type { Post } from '$lib/types/post';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { listProjects } from '$content/projects';
|
import type { PageLoad } from './$types';
|
||||||
|
|
||||||
export const load = () => {
|
export const load = async ({ fetch }) => {
|
||||||
return {
|
const response = await fetch('api/posts');
|
||||||
projects: listProjects()
|
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';
|
import type { PageLoad } from './$types';
|
||||||
|
|
||||||
export const entries = () => listProjects().map((post) => ({ slug: post.slug }));
|
export const entries = () => listProjects().map((post) => ({ slug: post.slug }));
|
||||||
|
|
Loading…
Reference in New Issue