From af38fb8c1cec300d79821ee6e206e3417729692b Mon Sep 17 00:00:00 2001 From: Neil Brommer Date: Thu, 13 Jul 2023 10:31:01 -0700 Subject: [PATCH] Fix drafts plugin --- eleventy.config.drafts.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/eleventy.config.drafts.js b/eleventy.config.drafts.js index 2de748f..0f15cd7 100644 --- a/eleventy.config.drafts.js +++ b/eleventy.config.drafts.js @@ -2,8 +2,7 @@ function eleventyComputedPermalink() { // When using `addGlobalData` and you *want* to return a function, you must nest functions like this. // `addGlobalData` acts like a global data file and runs the top level function it receives. return (data) => { - // Always skip during non-watch/serve builds - if(data.draft && !process.env.BUILD_DRAFTS) { + if(data.draft && process.env.BUILD_DRAFTS != "true") { return false; } @@ -15,8 +14,7 @@ function eleventyComputedExcludeFromCollections() { // When using `addGlobalData` and you *want* to return a function, you must nest functions like this. // `addGlobalData` acts like a global data file and runs the top level function it receives. return (data) => { - // Always exclude from non-watch/serve builds - if(data.draft && !process.env.BUILD_DRAFTS) { + if(data.draft && process.env.BUILD_DRAFTS != "true") { return true; } @@ -36,13 +34,11 @@ module.exports = eleventyConfig => { let text = "Excluding"; if(process.env.BUILD_DRAFTS == "true") { - process.env.BUILD_DRAFTS = true; text = "Including"; } // Only log once. if(!logged) { - console.log(process.env.BUILD_DRAFTS, typeof(process.env.BUILD_DRAFTS)); console.log( `[11ty/drafts] ${text} drafts.` ); }