update
This commit is contained in:
parent
517081a1e8
commit
e2438684f7
|
@ -63,6 +63,7 @@
|
||||||
"vitest-fetch-mock": "^0.2.2"
|
"vitest-fetch-mock": "^0.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@astrojs/rss": "^4.0.5",
|
||||||
"@ts-ghost/core-api": "^5.1.2",
|
"@ts-ghost/core-api": "^5.1.2",
|
||||||
"vite": "^5.1.2",
|
"vite": "^5.1.2",
|
||||||
"vite-tsconfig-paths": "^4.2.2"
|
"vite-tsconfig-paths": "^4.2.2"
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
import rss from "@astrojs/rss";
|
||||||
|
import type { APIContext } from "astro";
|
||||||
|
import { getAllPosts } from "../utils/api";
|
||||||
|
|
||||||
|
const posts = await getAllPosts();
|
||||||
|
import config from 'virtual:starlight-ghost-config'
|
||||||
|
|
||||||
|
export async function GET({ site }: APIContext) {
|
||||||
|
const title = config.title;
|
||||||
|
const description = config.rssDescription;
|
||||||
|
return rss({
|
||||||
|
title: title,
|
||||||
|
description: description,
|
||||||
|
site: site,
|
||||||
|
items: posts.map((post) => ({
|
||||||
|
title: post.title,
|
||||||
|
pubDate: new Date(
|
||||||
|
post.published_at ? post.published_at : post.created_at,
|
||||||
|
),
|
||||||
|
description: post.excerpt,
|
||||||
|
link: `/blog/${post.slug}/`,
|
||||||
|
author: post.primary_author?.name,
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
}
|
|
@ -15,6 +15,10 @@ const configSchema = z
|
||||||
* The title of the blog.
|
* The title of the blog.
|
||||||
*/
|
*/
|
||||||
title: z.string().default('Blog'),
|
title: z.string().default('Blog'),
|
||||||
|
/**
|
||||||
|
* The description of the blog on the RSS Feed.
|
||||||
|
*/
|
||||||
|
rssDescription: z.string(),
|
||||||
/**
|
/**
|
||||||
* Turn on and off "Powered by Ghost"
|
* Turn on and off "Powered by Ghost"
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -304,6 +304,9 @@ importers:
|
||||||
|
|
||||||
packages/starlight-ghostcms:
|
packages/starlight-ghostcms:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@astrojs/rss':
|
||||||
|
specifier: ^4.0.5
|
||||||
|
version: 4.0.5
|
||||||
'@ts-ghost/core-api':
|
'@ts-ghost/core-api':
|
||||||
specifier: ^5.1.2
|
specifier: ^5.1.2
|
||||||
version: 5.1.2
|
version: 5.1.2
|
||||||
|
|
Loading…
Reference in New Issue