upgrade to sveltekit 1

This commit is contained in:
2023-08-26 20:55:35 -07:00
parent 3a59f45e58
commit 1b2d55173a
24 changed files with 2206 additions and 6634 deletions

25
src/routes/_posts/all.js Normal file
View File

@@ -0,0 +1,25 @@
import { dev } from '$app/environment';
const posts = import.meta.globEager('./*.svx');
let postData = [];
for (const path in posts) {
// skip draft posts in production mode
if (!dev && posts[path].metadata.draft) {
continue;
}
// slice off the ./ and the .svx
const slug = path.slice(2, -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 { postData };