Add future posts filter
This commit is contained in:
parent
b49384088b
commit
b43a7c439d
1 changed files with 5 additions and 2 deletions
|
@ -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");
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue