[READ-ONLY] Mirror of https://github.com/flo-bit/flo-bit.github.io. my personal website, w/ astro, svelte, tailwind, typescript, threlte
flo-bit.dev/
portfolio
portfolio-website
svelte
sveltekit
tailwind
threejs
threlte
typescript
1.1 kB
35 lines
1import { getCollection } from 'astro:content';
2
3export const getFeaturedProjects = async () => {
4 return (await getCollection("projects"))
5 .filter((project: any) => project.data.featured)
6 .sort((a: any, b: any) => b.data.date.valueOf() - a.data.date.valueOf());
7};
8
9export const getProjects = async () => {
10 return (await getCollection("projects"))
11 .sort(
12 (a: any, b: any) => b.data.date.valueOf() - a.data.date.valueOf(),
13 );
14};
15
16export const getBlogPosts = async () => {
17 const posts = (await getCollection("blog"))
18 .filter((post: any) => post.data.published || import.meta.env.MODE === "development")
19 .sort(
20 (a: any, b: any) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
21 );
22
23 return posts;
24};
25
26
27export const getVisibleBlogPosts = async () => {
28 const posts = (await getCollection("blog"))
29 .filter((post: any) => post.data.published && post.data.visible || import.meta.env.MODE === "development")
30 .sort(
31 (a: any, b: any) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
32 );
33
34 return posts;
35};