Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
const feedPlugin = require("@11ty/eleventy-plugin-rss");

const BROWSER_BUG_TRACKERS = {
chrome: "issues.chromium.org",
Expand Down Expand Up @@ -122,7 +123,7 @@ function augmentFeatureData(id, feature, bcd) {
// Find the BCD entry for this key.
const keyParts = key.split(".");
bcdTags.push(keyParts[0] === "javascript" ? "js" : keyParts[0]);

let data = bcd;
for (const part of keyParts) {
if (!data || !data[part]) {
Expand Down Expand Up @@ -204,7 +205,6 @@ async function getDeps() {
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPassthroughCopy("site/assets");

eleventyConfig.addShortcode(
"browserVersionRelease",
function (browser, version) {
Expand Down Expand Up @@ -344,16 +344,24 @@ module.exports = function (eleventyConfig) {
}
}

const now = new Date();
return [...monthly]
.sort((a, b) => {
return new Date(b[0]) - new Date(a[0]);
})
.map((month) => {
const absoluteDate = new Date(month[0]);
const isCurrentMonth = absoluteDate.getMonth() === now.getMonth() && absoluteDate.getFullYear() === now.getFullYear();
return {
date: new Date(month[0]).toLocaleDateString("en-us", {
month: "long",
year: "numeric",
}),
absoluteDate: absoluteDate,
// current month is not stable because it is still updating
// RSS feed should not include the current month
// https://github.com/web-platform-dx/web-features-explorer/pull/23
isStableMonth: !isCurrentMonth,
all: [...month[1].all],
features: month[1],
};
Expand Down Expand Up @@ -476,6 +484,10 @@ module.exports = function (eleventyConfig) {
return missingOne;
});

// RSS Feed Plugin
eleventyConfig.addPlugin(feedPlugin);
eleventyConfig.addLiquidFilter("dateToRfc3339", feedPlugin.dateToRfc3339);

return {
dir: {
input: "site",
Expand Down
Loading