mirror of
https://github.com/LukeHagar/Sveltey.git
synced 2025-12-06 04:21:38 +00:00
upadting lock, and blog post load function
This commit is contained in:
2472
package-lock.json
generated
2472
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,10 @@
|
||||
// src/routes/blog/[slug]/+page.server.ts
|
||||
import { getAllPosts } from '$lib/blog';
|
||||
import { getAllPosts, getPostBySlug } from '$lib/blog';
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
export const load = async ({ params }) => {
|
||||
// Get only the metadata for the post
|
||||
const posts = await getAllPosts();
|
||||
const post = posts.find(p => p.slug === params.slug);
|
||||
const post = await getPostBySlug(params.slug);
|
||||
|
||||
if (!post) {
|
||||
throw error(404, 'Blog post not found');
|
||||
|
||||
Reference in New Issue
Block a user