Skip to content

Commit

Permalink
fix astro build
Browse files Browse the repository at this point in the history
  • Loading branch information
richardgill committed Apr 1, 2024
1 parent fea2a2c commit 2bd9a49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
16 changes: 8 additions & 8 deletions apps/www/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions apps/www/src/components/BlogHeader.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
import { getCategories } from "@/lib/fetchers";
const categories = await getCategories();
type Props = {
title: string;
};
Expand Down
19 changes: 0 additions & 19 deletions apps/www/src/lib/fetchers.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
import { getCollection } from "astro:content";

export const getCategories = async () => {
const posts = await getCollection("blog");
const categories = [
...new Set(posts.map((post) => post.data.category).flat()),
];

return categories;
};

export const getPosts = async () => {
const posts = (await getCollection("blog")).sort(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
);

return posts;
};

export const getPostsByCategory = async (category: string) => {
const posts = (await getCollection("blog"))
.filter((post) => post.data.category.includes(category))
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());

return posts;
};

export const getGuides = async () => {
const guides = (await getCollection("guides"))
.filter((guide) => guide.data.published)
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());

return guides;
};

0 comments on commit 2bd9a49

Please sign in to comment.