summaryrefslogtreecommitdiff
path: root/smoke/astro.build-main/src/posts/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'smoke/astro.build-main/src/posts/index.ts')
-rw-r--r--smoke/astro.build-main/src/posts/index.ts32
1 files changed, 0 insertions, 32 deletions
diff --git a/smoke/astro.build-main/src/posts/index.ts b/smoke/astro.build-main/src/posts/index.ts
deleted file mode 100644
index 9999605cb..000000000
--- a/smoke/astro.build-main/src/posts/index.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { parse, isBefore } from 'date-fns';
-
-export async function getAllPosts() {
- const files = await import.meta.glob("./**/*.md");
- const posts = (
- await Promise.all(
- Object.values(files).map((importFile: any, index) =>
- importFile().then((res) => {
- const { title, description, authors, publishDate, socialImage } = res.frontmatter;
- const href = Object.keys(files)
- [index].replace(/^\./, "/blog")
- .replace(/\.md$/, "");
-
- return {
- title,
- description,
- authors,
- publishDate: parse(publishDate, "MMMM d, yyyy", new Date()),
- socialImage,
- href,
- Content: res.default
- };
- })
- )
- )
- ).sort((a, b) => {
- if (isBefore(a.publishDate, b.publishDate)) return 1;
- if (isBefore(b.publishDate, a.publishDate)) return -1;
- return 0;
- });
- return posts;
-}