From 5764da5ead001a025d300357ffdf214a1b45d938 Mon Sep 17 00:00:00 2001 From: George Pollard Date: Fri, 14 Jun 2024 20:30:47 +0000 Subject: [PATCH] Don't emit drafts in production --- src/articles/articles.11tydata.js | 11 +++++++++-- src/games/games.11tydata.js | 11 ++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/articles/articles.11tydata.js b/src/articles/articles.11tydata.js index 61ae92cf..29e95b6b 100644 --- a/src/articles/articles.11tydata.js +++ b/src/articles/articles.11tydata.js @@ -21,8 +21,15 @@ let data = { /* copy across our own attributes */ titleLang: data => data.titleLang, draft: data => data.draft, - } - } + permalink: data => { + if (IS_PRODUCTION && data.draft === true) { + return false; + } else { + return undefined; + } + }, + }, + }, } //if (IS_PRODUCTION) { diff --git a/src/games/games.11tydata.js b/src/games/games.11tydata.js index 9d36a981..859241a3 100644 --- a/src/games/games.11tydata.js +++ b/src/games/games.11tydata.js @@ -2,7 +2,16 @@ const { IS_PRODUCTION } = require("../../helpers"); let data = { "layout": "article", - "tags": "game" + "tags": "game", + eleventyComputed: { + permalink: data => { + if (IS_PRODUCTION && data.draft === true) { + return false; + } else { + return undefined; + } + }, + }, }; //if (IS_PRODUCTION) {