-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from Linaro/webdev-2012-rss-feed
Add rss feed and link
- Loading branch information
Showing
8 changed files
with
138 additions
and
26 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
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
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,24 @@ | ||
import rss from "@astrojs/rss"; | ||
import { getCollection } from "astro:content"; | ||
|
||
export async function GET(context) { | ||
const blog = await getCollection("blogs"); | ||
|
||
const items = [ | ||
...blog.map((item) => ({ | ||
title: item.data.title, | ||
pubDate: item.data.date, | ||
description: item.data.description, | ||
link: `/blog/${item.slug}`, | ||
})), | ||
].sort((a, b) => { | ||
return b.pubDate - a.pubDate; | ||
}); | ||
|
||
return rss({ | ||
title: "Linaro Blog RSS Feed", | ||
description: "Linaro Blog", | ||
site: context.site, | ||
items: items, | ||
}); | ||
} |
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,24 @@ | ||
import rss from "@astrojs/rss"; | ||
import { getCollection } from "astro:content"; | ||
|
||
export async function GET(context) { | ||
const news = await getCollection("news"); | ||
|
||
const items = [ | ||
...news.map((item) => ({ | ||
title: item.data.title, | ||
pubDate: item.data.date, | ||
description: item.data.description, | ||
link: `/news/${item.slug}`, | ||
})), | ||
].sort((a, b) => { | ||
return b.pubDate - a.pubDate; | ||
}); | ||
|
||
return rss({ | ||
title: "Linaro News RSS Feed", | ||
description: "Linaro News", | ||
site: context.site, | ||
items: items, | ||
}); | ||
} |
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 |
---|---|---|
|
@@ -164,6 +164,14 @@ | |
dependencies: | ||
prismjs "^1.29.0" | ||
|
||
"@astrojs/rss@^4.0.7": | ||
version "4.0.7" | ||
resolved "https://registry.yarnpkg.com/@astrojs/rss/-/rss-4.0.7.tgz#af08243ed3c6e29448ecf2c2546f86cd5cf23f27" | ||
integrity sha512-ZEG55XFB19l+DplUvBISmz04UbjDtKliRO4Y5+ERRhAMjgCVVobEBNE6ZwWG1h6orWUocy4nfPihKXDyB73x9g== | ||
dependencies: | ||
fast-xml-parser "^4.4.0" | ||
kleur "^4.1.5" | ||
|
||
"@astrojs/sitemap@^3.1.2": | ||
version "3.1.4" | ||
resolved "https://registry.yarnpkg.com/@astrojs/sitemap/-/sitemap-3.1.4.tgz#9805bd69343572c9da2febd722cbca9797f66f94" | ||
|
@@ -5265,6 +5273,13 @@ [email protected]: | |
dependencies: | ||
strnum "^1.0.5" | ||
|
||
fast-xml-parser@^4.4.0: | ||
version "4.5.0" | ||
resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.5.0.tgz#2882b7d01a6825dfdf909638f2de0256351def37" | ||
integrity sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg== | ||
dependencies: | ||
strnum "^1.0.5" | ||
|
||
fastq@^1.6.0: | ||
version "1.17.1" | ||
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" | ||
|