Skip to content

Commit dee5789

Browse files
Merge pull request #23 from azu/add-rss-to-release-notes
feat: add RSS Feed for /release-notes
2 parents 3da1cd7 + ceef1df commit dee5789

File tree

5 files changed

+414
-126
lines changed

5 files changed

+414
-126
lines changed

.eleventy.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
2+
const feedPlugin = require("@11ty/eleventy-plugin-rss");
23

34
const BROWSER_BUG_TRACKERS = {
45
chrome: "issues.chromium.org",
@@ -122,7 +123,7 @@ function augmentFeatureData(id, feature, bcd) {
122123
// Find the BCD entry for this key.
123124
const keyParts = key.split(".");
124125
bcdTags.push(keyParts[0] === "javascript" ? "js" : keyParts[0]);
125-
126+
126127
let data = bcd;
127128
for (const part of keyParts) {
128129
if (!data || !data[part]) {
@@ -204,7 +205,6 @@ async function getDeps() {
204205
module.exports = function (eleventyConfig) {
205206
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
206207
eleventyConfig.addPassthroughCopy("site/assets");
207-
208208
eleventyConfig.addShortcode(
209209
"browserVersionRelease",
210210
function (browser, version) {
@@ -344,16 +344,24 @@ module.exports = function (eleventyConfig) {
344344
}
345345
}
346346

347+
const now = new Date();
347348
return [...monthly]
348349
.sort((a, b) => {
349350
return new Date(b[0]) - new Date(a[0]);
350351
})
351352
.map((month) => {
353+
const absoluteDate = new Date(month[0]);
354+
const isCurrentMonth = absoluteDate.getMonth() === now.getMonth() && absoluteDate.getFullYear() === now.getFullYear();
352355
return {
353356
date: new Date(month[0]).toLocaleDateString("en-us", {
354357
month: "long",
355358
year: "numeric",
356359
}),
360+
absoluteDate: absoluteDate,
361+
// current month is not stable because it is still updating
362+
// RSS feed should not include the current month
363+
// https://github.com/web-platform-dx/web-features-explorer/pull/23
364+
isStableMonth: !isCurrentMonth,
357365
all: [...month[1].all],
358366
features: month[1],
359367
};
@@ -476,6 +484,10 @@ module.exports = function (eleventyConfig) {
476484
return missingOne;
477485
});
478486

487+
// RSS Feed Plugin
488+
eleventyConfig.addPlugin(feedPlugin);
489+
eleventyConfig.addLiquidFilter("dateToRfc3339", feedPlugin.dateToRfc3339);
490+
479491
return {
480492
dir: {
481493
input: "site",

0 commit comments

Comments
 (0)