From db0860ae2e262456875970eee65fb36f86c2f783 Mon Sep 17 00:00:00 2001 From: Neil Brommer Date: Mon, 10 Jul 2023 15:22:32 -0700 Subject: [PATCH] Improve draft filtering --- eleventy.config.js | 2 +- src/posts/index.njk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eleventy.config.js b/eleventy.config.js index 56599a0..0a6c26c 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -49,7 +49,7 @@ module.exports = function (eleventyConfig) { collection.sort((a, b) => a.data.sectionOrder - b.data.sectionOrder) ); eleventyConfig.addFilter("filterDrafts", collection => { - if (process.env.BUILD_DRAFTS) { + if (process.env.BUILD_DRAFTS == true || process.env.BUILD_DRAFTS == null) { return collection; } diff --git a/src/posts/index.njk b/src/posts/index.njk index 775e6b8..b6ae4d6 100644 --- a/src/posts/index.njk +++ b/src/posts/index.njk @@ -7,5 +7,5 @@ eleventyNavigation: order: 1 --- -{% set postsList = collections.posts | IsNotPage(page.url) %} +{% set postsList = collections.posts | filterDrafts | IsNotPage(page.url) %} {% include "posts-list.njk" %}