Add future posts filter

This commit is contained in:
Erick Ruiz de Chavez 2021-02-08 07:47:17 -05:00
parent b49384088b
commit b43a7c439d

View file

@ -1,6 +1,6 @@
const pluginTailwindCSS = require("eleventy-plugin-tailwindcss"); const pluginTailwindCSS = require("eleventy-plugin-tailwindcss");
const pluginRss = require("@11ty/eleventy-plugin-rss"); const pluginRss = require("@11ty/eleventy-plugin-rss");
const cacheBuster = require('@mightyplow/eleventy-plugin-cache-buster'); const cacheBuster = require("@mightyplow/eleventy-plugin-cache-buster");
module.exports = function (eleventyConfig) { module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("_content/images"); eleventyConfig.addPassthroughCopy("_content/images");
@ -16,7 +16,7 @@ module.exports = function (eleventyConfig) {
createResourceHash() { createResourceHash() {
return Date.now(); return Date.now();
}, },
// outputDirectory: "_site", // outputDirectory: "_site",
}; };
eleventyConfig.addPlugin(cacheBuster(cacheBusterOptions)); eleventyConfig.addPlugin(cacheBuster(cacheBusterOptions));
@ -27,9 +27,12 @@ module.exports = function (eleventyConfig) {
month: "long", month: "long",
}); });
const now = Date.now();
return collectionApi return collectionApi
.getFilteredByGlob("**/blog/*.md") .getFilteredByGlob("**/blog/*.md")
.reverse() .reverse()
.filter((item) => item.date.getTime() <= now)
.reduce((agg, item) => { .reduce((agg, item) => {
const group = formatter.format(item.date); const group = formatter.format(item.date);