dependabot/npm_and_yarn/prettier-3.7.4
copilot/add-i18n-support-for-english
dependabot/npm_and_yarn/astro-5.16.4
dependabot/npm_and_yarn/katex-0.16.27
dependabot/npm_and_yarn/prettier-3.7.4
dependabot/npm_and_yarn/tailwindcss-4.1.16
dependabot/npm_and_yarn/tailwindcss/vite-4.1.16
dependabot/npm_and_yarn/typescript-eslint-8.46.2
dependabot/npm_and_yarn/typescript-eslint/parser-8.46.2
development
main
| 1 | import { getCollection, type CollectionEntry } from 'astro:content' |
| 2 | |
| 3 | /** |
| 4 | * Get all posts, filtering out posts whose filenames start with _ and static pages |
| 5 | */ |
| 6 | export async function getFilteredPosts() { |
| 7 | const posts = await getCollection('posts') |
| 8 | const staticPages = ['privacy-policy', 'terms-of-use'] |
| 9 | return posts.filter((post) => !post.id.startsWith('_') && !staticPages.includes(post.id)) |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * Get all posts sorted by publication date, filtering out posts whose filenames start with _ |
| 14 | */ |
| 15 | export async function getSortedFilteredPosts() { |
| 16 | const posts = await getFilteredPosts() |
| 17 | return posts.sort( |
| 18 | (a: CollectionEntry<'posts'>, b: CollectionEntry<'posts'>) => |
| 19 | b.data.pubDate.valueOf() - a.data.pubDate.valueOf() |
| 20 | ) |
| 21 | } |