/
yeltsov
/
astro-chiri
Обзор
Документация
Войти
/
yeltsov
/
astro-chiri
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/utils/draft.ts
19 строк
656 B
ilya yeltsov
first_commit
12 апр 2026, 09:26
12 апр 2026, 09:26
691ca0f
Код
Авторство
О чём код?
import { 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'>) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf() ) }