23 lines
478 B
JavaScript
23 lines
478 B
JavaScript
const posts = import.meta.globEager('./_posts/*.svx');
|
|
|
|
export let postData = [];
|
|
|
|
for (const path in posts) {
|
|
const slug = path.slice(9, -4)
|
|
posts[path].metadata.slug = slug;
|
|
postData.push(posts[path].metadata);
|
|
}
|
|
postData.sort((a, b) => {
|
|
// sorting in reverse, so we flip the intuitive order
|
|
if (a.date > b.date) return -1;
|
|
if (a.date < b.date) return 1;
|
|
return 0;
|
|
})
|
|
|
|
export async function get() {
|
|
return {
|
|
body: {postData}
|
|
};
|
|
}
|
|
|