20 lines
437 B
TypeScript
20 lines
437 B
TypeScript
/*
|
|
* Provides post summaries to all pages. That means every page can access summaries
|
|
* for all posts on the website.
|
|
*/
|
|
|
|
import { type Post, posts } from './posts/posts_data';
|
|
|
|
export function load() {
|
|
let summaries : Post[] = [];
|
|
|
|
// Sort by newest news first
|
|
posts.sort((a, b) => b.creation_date - a.creation_date);
|
|
|
|
posts.forEach((post) => {
|
|
summaries.push(post);
|
|
});
|
|
|
|
return { summaries };
|
|
}
|