|
1 | | -import path from "~/lib/path"; |
2 | 1 | import rss from "@astrojs/rss"; |
3 | | -import { getCollection, type ContentEntryMap } from "astro:content"; |
4 | | -import { SITE_TITLE, SITE_DESCRIPTION, gardenBasePath } from "../config"; |
5 | | -import { collections } from "~/content/config"; |
| 2 | +import type { RSSFeedItem } from "@astrojs/rss"; |
| 3 | +import { SITE_TITLE, SITE_DESCRIPTION } from "../config"; |
| 4 | +//import path from "~/lib/path"; |
| 5 | +//import { getCollection, type ContentEntryMap } from "astro:content"; |
| 6 | +//import { collections } from "~/content/config"; |
6 | 7 |
|
7 | 8 | export const GET = async () => { |
8 | | - let posts = []; |
9 | | - for (const k in collections) { |
10 | | - posts.push(...(await getCollection(k as keyof ContentEntryMap))); |
11 | | - } |
12 | | - const items = posts.filter((p) => !p.data.draft).map((p) => { |
13 | | - return { |
14 | | - link: p.collection === "garden" |
15 | | - ? path.join(gardenBasePath, p.slug) |
16 | | - : path.join("blog", p.slug), |
17 | | - title: p.data.title, |
18 | | - pubDate: p.data.pubDate, |
19 | | - description: p.data.description, |
20 | | - categories: p.data.tags, |
21 | | - }; |
22 | | - }); |
| 9 | + // let posts = []; |
| 10 | + // for (const k in collections) { |
| 11 | + // let c = await getCollection(k as keyof ContentEntryMap, ({ data }) => { |
| 12 | + // console.log(data); |
| 13 | + // return !data.draft; |
| 14 | + // }); |
| 15 | + // // console.log(c); |
| 16 | + // posts.push(...(await getCollection(k as keyof ContentEntryMap))); |
| 17 | + // } |
| 18 | + // const items = posts.filter((p) => !p.data.draft).map((p) => { |
| 19 | + // return { |
| 20 | + // link: p.collection === "garden" |
| 21 | + // ? path.join(gardenBasePath, p.slug) |
| 22 | + // : path.join("blog", p.slug), |
| 23 | + // title: p.data.title, |
| 24 | + // pubDate: p.data.pubDate, |
| 25 | + // description: p.data.description, |
| 26 | + // categories: p.data.tags, |
| 27 | + // }; |
| 28 | + // }); |
| 29 | + let items: RSSFeedItem[] = []; |
23 | 30 | return rss({ |
24 | 31 | title: SITE_TITLE, |
25 | 32 | description: SITE_DESCRIPTION, |
|
0 commit comments