Skip to content

Commit 3e0e929

Browse files
Fix RSS Feed
1 parent a4c3184 commit 3e0e929

File tree

3 files changed

+74
-22
lines changed

3 files changed

+74
-22
lines changed

package-lock.json

Lines changed: 64 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"unist-util-visit": "^4.1.0"
1919
},
2020
"dependencies": {
21+
"@astrojs/rss": "^2.4.3",
2122
"parse-numeric-range": "^1.3.0",
2223
"preact": "^10.13.2",
2324
"specificity": "^0.4.1"
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
---
2-
import BlogPost from "../layouts/BlogPost.astro"
1+
import rss from "@astrojs/rss"
32

4-
export async function getStaticPaths({ rss }) {
5-
const allPosts = await Astro.glob("../**/*.md")
6-
const sortedPosts = allPosts.sort(
3+
export function get(context) {
4+
let allMarkdownPosts = Object.values(
5+
import.meta.glob("./**/*.mdx", { eager: true })
6+
)
7+
const allPosts = allMarkdownPosts.sort(
78
(a, b) => b.frontmatter.date.valueOf() - a.frontmatter.date.valueOf()
89
)
910

10-
rss({
11+
return rss({
1112
title: "Web Dev Simplified Blog",
1213
description: "Web Dev Simplified Blog",
1314
customData: `<language>en-us</language>`,
14-
items: sortedPosts.map(item => ({
15+
site: context.site,
16+
items: allPosts.map(item => ({
1517
title: item.frontmatter.title,
1618
description: item.frontmatter.description,
1719
link: item.url,
1820
pubDate: item.frontmatter.date,
1921
})),
2022
})
21-
22-
return []
2323
}
24-
---
25-
26-
<BlogPost {...props} />
27-
28-
<!-- TODO: Fix rss feed if needed -->

0 commit comments

Comments
 (0)