This commit is contained in:
Adam Matthiesen 2024-01-23 17:54:45 -08:00
parent 7f54865160
commit db52b353fb
2 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "@matthiesenxyz/astro-ghostcms", "name": "@matthiesenxyz/astro-ghostcms",
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content", "description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
"version": "3.0.5", "version": "3.0.6",
"homepage": "https://astro-ghostcms.xyz/", "homepage": "https://astro-ghostcms.xyz/",
"type": "module", "type": "module",
"license": "MIT", "license": "MIT",

View File

@ -1,18 +1,19 @@
import rss from "@astrojs/rss"; import rss from "@astrojs/rss";
import { getPosts, getSettings } from '../api'; import { getAllPosts, getSettings } from '../api';
import invariant from "tiny-invariant"; import invariant from "tiny-invariant";
export async function GET(context) { export async function GET(context) {
const posts = await getPosts(); const posts = await getAllPosts();
const settings = await getSettings(); const settings = await getSettings();
invariant(settings, "Settings not found"); invariant(settings, "Settings not found");
const allPosts = [...posts];
const title = settings.title; const title = settings.title;
const description = settings.description; const description = settings.description;
return rss({ return rss({
title: title, title: title,
description: description, description: description,
site: context.site, site: context.site,
items: posts.map((post) => ({ items: allPosts.map((post) => ({
title: post.title, title: post.title,
pubDate: post.published_at, pubDate: post.published_at,
description: post.excerpt, description: post.excerpt,