[READ-ONLY] Mirror of https://github.com/flo-bit/blog-template. minimalistic astro blog template flo-bit.dev/blog-template/
astro blog template
0

Configure Feed

Select the types of activity you want to include in your feed.

blog-template / src / utils.ts
366 B 11 lines
1import { getCollection } from "astro:content"; 2 3export const getBlogPosts = async (showHidden = false) => { 4 const posts = (await getCollection("blog")) 5 .filter((post: any) => post.data.published !== false && (showHidden || !post.data.hidden)) 6 .sort( 7 (a: any, b: any) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(), 8 ); 9 10 return posts; 11};