|
1 | 1 | const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
|
| 2 | +const feedPlugin = require("@11ty/eleventy-plugin-rss"); |
2 | 3 |
|
3 | 4 | const BROWSER_BUG_TRACKERS = {
|
4 | 5 | chrome: "issues.chromium.org",
|
@@ -122,7 +123,7 @@ function augmentFeatureData(id, feature, bcd) {
|
122 | 123 | // Find the BCD entry for this key.
|
123 | 124 | const keyParts = key.split(".");
|
124 | 125 | bcdTags.push(keyParts[0] === "javascript" ? "js" : keyParts[0]);
|
125 |
| - |
| 126 | + |
126 | 127 | let data = bcd;
|
127 | 128 | for (const part of keyParts) {
|
128 | 129 | if (!data || !data[part]) {
|
@@ -204,7 +205,6 @@ async function getDeps() {
|
204 | 205 | module.exports = function (eleventyConfig) {
|
205 | 206 | eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
206 | 207 | eleventyConfig.addPassthroughCopy("site/assets");
|
207 |
| - |
208 | 208 | eleventyConfig.addShortcode(
|
209 | 209 | "browserVersionRelease",
|
210 | 210 | function (browser, version) {
|
@@ -344,16 +344,24 @@ module.exports = function (eleventyConfig) {
|
344 | 344 | }
|
345 | 345 | }
|
346 | 346 |
|
| 347 | + const now = new Date(); |
347 | 348 | return [...monthly]
|
348 | 349 | .sort((a, b) => {
|
349 | 350 | return new Date(b[0]) - new Date(a[0]);
|
350 | 351 | })
|
351 | 352 | .map((month) => {
|
| 353 | + const absoluteDate = new Date(month[0]); |
| 354 | + const isCurrentMonth = absoluteDate.getMonth() === now.getMonth() && absoluteDate.getFullYear() === now.getFullYear(); |
352 | 355 | return {
|
353 | 356 | date: new Date(month[0]).toLocaleDateString("en-us", {
|
354 | 357 | month: "long",
|
355 | 358 | year: "numeric",
|
356 | 359 | }),
|
| 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, |
357 | 365 | all: [...month[1].all],
|
358 | 366 | features: month[1],
|
359 | 367 | };
|
@@ -476,6 +484,10 @@ module.exports = function (eleventyConfig) {
|
476 | 484 | return missingOne;
|
477 | 485 | });
|
478 | 486 |
|
| 487 | + // RSS Feed Plugin |
| 488 | + eleventyConfig.addPlugin(feedPlugin); |
| 489 | + eleventyConfig.addLiquidFilter("dateToRfc3339", feedPlugin.dateToRfc3339); |
| 490 | + |
479 | 491 | return {
|
480 | 492 | dir: {
|
481 | 493 | input: "site",
|
|
0 commit comments