-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updates and new RSS feature * Update Navbar and constants Remove commented out code in Navbar.astro and update ROADMAP_URL constant in constants.ts to point to the new GitHub roadmap project.
- Loading branch information
1 parent
294b51a
commit c23fe5f
Showing
11 changed files
with
273 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { getCollection, getEntry } from 'astro:content'; | ||
import rss from '@astrojs/rss'; | ||
import type { APIContext, APIRoute } from 'astro'; | ||
|
||
import { experimental_AstroContainer as AstroContainer } from 'astro/container'; | ||
|
||
export const GET: APIRoute = async ({ site }: APIContext) => { | ||
// Get the blog collection | ||
const blog = await getCollection('blog'); | ||
|
||
// Create an Astro container to render the blog post content | ||
const container = await AstroContainer.create(); | ||
|
||
return rss({ | ||
title: 'StudioCMS', | ||
description: | ||
'A dedicated CMS for Astro and Astro DB. Built from the ground up by the Astro community.', | ||
site: site, | ||
trailingSlash: false, | ||
stylesheet: '/styles/rss.xsl', | ||
items: await Promise.all( | ||
blog | ||
.sort( | ||
// Sort the blog posts by publish date from newest to oldest | ||
({ data: { publishDate: a } }, { data: { publishDate: b } }) => b.getTime() - a.getTime() | ||
) | ||
.map(async ({ render, slug, data: { title, description, tags, publishDate, author } }) => ({ | ||
title: title, | ||
description: description, | ||
pubDate: publishDate, | ||
categories: tags, | ||
author: (await getEntry(author.collection, author.id)).data.link, | ||
link: `${site}blog/${slug}`, | ||
content: await container.renderToString((await render()).Content), | ||
})) | ||
), | ||
}); | ||
}; |