feat: optional dates, otherwise fetched from git

This commit is contained in:
Lewis Wynne 2026-01-31 23:39:29 +00:00
parent 4d9e3c56da
commit cc6eff22a8
8 changed files with 90 additions and 31 deletions

View file

@ -1,18 +1,19 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import type { APIContext } from 'astro';
import { getSlug } from '../lib/md';
import { getSlug, enrichPostsWithDates } from '../lib/md';
import { getTxtFiles } from '../lib/txt';
export async function GET(context: APIContext) {
const posts = await getCollection('md', ({ data }) => data.draft !== true);
const rawPosts = await getCollection('md', ({ data }) => data.draft !== true);
const posts = enrichPostsWithDates(rawPosts);
const bookmarks = await getCollection('bookmarks');
const txtFiles = getTxtFiles();
const items = [
...posts.map(post => ({
title: post.data.title,
pubDate: post.data.date,
pubDate: post.dates.created,
link: `/md/${getSlug(post.id)}`,
description: post.data.title,
})),