Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/trueberryless/the-thinking-hub. The central knowledge hub for 8 key Computer Science thinking modes. the-thinking-hub.felixs.dev
Something went wrong. Try again.
662 B · 20 lines
TypeScript
123456789101112131415161718192021import { getCollection, type CollectionEntry } from 'astro:content'
/** * Get all posts, filtering out posts whose filenames start with _ */export async function getFilteredPosts() { const posts = await getCollection('posts') return posts.filter((post: CollectionEntry<'posts'>) => !post.id.startsWith('_'))}
/** * Get all posts sorted by publication date, filtering out posts whose filenames start with _ */export async function getSortedFilteredPosts() { const posts = await getFilteredPosts() return posts.sort( (a: CollectionEntry<'posts'>, b: CollectionEntry<'posts'>) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf() )}