From 1b4f05d6bc50f424f30ba3dfbeb66436201f718d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 07:58:09 +0000 Subject: [PATCH 1/4] feat: Exclude future posts from collections but keep them published; Add Q1 2026 post - Modify `posts/posts.11tydata.js` to exclude posts with future dates (or scheduled dates) from collections, while keeping their pages generated. - Add `posts/blog/2026/q1-2026.md` with content for Q1 2026, dated 2026-04-01. Co-authored-by: si <18108+si@users.noreply.github.com> --- posts/blog/2026/q1-2026.md | 18 ++++++++++++++++++ posts/posts.11tydata.js | 21 +++++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 posts/blog/2026/q1-2026.md diff --git a/posts/blog/2026/q1-2026.md b/posts/blog/2026/q1-2026.md new file mode 100644 index 0000000..80082b2 --- /dev/null +++ b/posts/blog/2026/q1-2026.md @@ -0,0 +1,18 @@ +--- +title: "Q1 2026" +date: 2026-04-01 +categories: + - "blog" +--- + +Introduction to Q1 2026. + +## January + +Lovely weekend away at Brownsover Hall, recently renovated local house. Romantic break with Mrs J, quality time together and loads of different meals (afternoon tea, evening meal and big breakfast). Decor is beautiful and food was pretty good but some of the customer service needs attention with us having to remind many waiters and waitresses for drinks. + +Returned the boy to + +## February + +## March diff --git a/posts/posts.11tydata.js b/posts/posts.11tydata.js index 2b04f11..b98c048 100644 --- a/posts/posts.11tydata.js +++ b/posts/posts.11tydata.js @@ -1,12 +1,21 @@ const todaysDate = new Date(); const isDev = require("../_data/isdevelopment")(); -function showDraft(data) { +function isPublished(data) { if (isDev) return true; const isDraft = "draft" in data && data.draft !== false; - const isPostInFuture = - "scheduled" in data ? data.scheduled > todaysDate : false; - return !isDraft && !isPostInFuture; + return !isDraft; +} + +function isCollectionVisible(data) { + if (!isPublished(data)) return false; + + if (isDev) return true; + + const isScheduledInFuture = "scheduled" in data ? data.scheduled > todaysDate : false; + const isPostInFuture = data.date > todaysDate; + + return !isScheduledInFuture && !isPostInFuture; } module.exports = () => { @@ -15,9 +24,9 @@ module.exports = () => { templateClass: "tmpl-post", eleventyComputed: { eleventyExcludeFromCollections: (data) => - showDraft(data) ? data.eleventyExcludeFromCollections : true, + isCollectionVisible(data) ? data.eleventyExcludeFromCollections : true, permalink: (data) => { - if (!showDraft(data)) return false; + if (!isPublished(data)) return false; if (data.permalink) return data.permalink; From 013add6cb39cd960359217eb49fceb1913babd91 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 08:06:36 +0000 Subject: [PATCH 2/4] fix: Safe process access and robust date handling for CI - Modify `_data/isdevelopment.js` to check for `process` existence before accessing `process.argv`, preventing ReferenceError in non-Node environments (like Cloudflare Workers). - Update `posts/posts.11tydata.js` to robustly convert `date` and `scheduled` to Date objects before comparison, and handle undefined values gracefully. Co-authored-by: si <18108+si@users.noreply.github.com> --- _data/isdevelopment.js | 5 ++++- posts/posts.11tydata.js | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/_data/isdevelopment.js b/_data/isdevelopment.js index 5132e90..f289bb8 100644 --- a/_data/isdevelopment.js +++ b/_data/isdevelopment.js @@ -20,6 +20,9 @@ */ module.exports = function () { - // YOLO. + // Check if process exists before accessing it (safe for Cloudflare Workers etc) + if (typeof process === "undefined" || !process.argv) { + return false; + } return /serve|watch/.test(process.argv.join()); }; diff --git a/posts/posts.11tydata.js b/posts/posts.11tydata.js index b98c048..2e2839c 100644 --- a/posts/posts.11tydata.js +++ b/posts/posts.11tydata.js @@ -12,8 +12,12 @@ function isCollectionVisible(data) { if (isDev) return true; - const isScheduledInFuture = "scheduled" in data ? data.scheduled > todaysDate : false; - const isPostInFuture = data.date > todaysDate; + // Robustly handle dates, defaulting to today if missing (shouldn't happen for posts) + const scheduledDate = "scheduled" in data ? new Date(data.scheduled) : null; + const postDate = data.date ? new Date(data.date) : todaysDate; + + const isScheduledInFuture = scheduledDate ? scheduledDate > todaysDate : false; + const isPostInFuture = postDate > todaysDate; return !isScheduledInFuture && !isPostInFuture; } @@ -24,7 +28,7 @@ module.exports = () => { templateClass: "tmpl-post", eleventyComputed: { eleventyExcludeFromCollections: (data) => - isCollectionVisible(data) ? data.eleventyExcludeFromCollections : true, + isCollectionVisible(data) ? (data.eleventyExcludeFromCollections || false) : true, permalink: (data) => { if (!isPublished(data)) return false; From baabc1411acfa1d715def4410aad73cf0ab9217d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 08:16:18 +0000 Subject: [PATCH 3/4] fix: Enhance robustness of build scripts for CI environments - Modify `_data/isdevelopment.js` to use try-catch and check for existence of `process`, `process.argv`, and `Array.isArray(process.argv)` to prevent crashes in non-standard environments (like Cloudflare Workers). - Update `posts/posts.11tydata.js` to guard against missing `data` or invalid date values in `eleventyComputed` functions, and ensure `scheduled` date handling is safe. Co-authored-by: si <18108+si@users.noreply.github.com> --- _data/isdevelopment.js | 10 +++++++--- posts/posts.11tydata.js | 12 +++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/_data/isdevelopment.js b/_data/isdevelopment.js index f289bb8..6c0f5a2 100644 --- a/_data/isdevelopment.js +++ b/_data/isdevelopment.js @@ -20,9 +20,13 @@ */ module.exports = function () { - // Check if process exists before accessing it (safe for Cloudflare Workers etc) - if (typeof process === "undefined" || !process.argv) { + try { + // Check if process exists and has argv array (safe for Cloudflare Workers etc) + if (typeof process === "undefined" || !process || !process.argv || !Array.isArray(process.argv)) { + return false; + } + return /serve|watch/.test(process.argv.join()); + } catch (e) { return false; } - return /serve|watch/.test(process.argv.join()); }; diff --git a/posts/posts.11tydata.js b/posts/posts.11tydata.js index 2e2839c..7cd8fd5 100644 --- a/posts/posts.11tydata.js +++ b/posts/posts.11tydata.js @@ -2,22 +2,24 @@ const todaysDate = new Date(); const isDev = require("../_data/isdevelopment")(); function isPublished(data) { + if (!data) return true; // Default to published if data missing (unlikely) if (isDev) return true; const isDraft = "draft" in data && data.draft !== false; return !isDraft; } function isCollectionVisible(data) { + if (!data) return false; if (!isPublished(data)) return false; if (isDev) return true; // Robustly handle dates, defaulting to today if missing (shouldn't happen for posts) - const scheduledDate = "scheduled" in data ? new Date(data.scheduled) : null; + const scheduledDate = "scheduled" in data && data.scheduled ? new Date(data.scheduled) : null; const postDate = data.date ? new Date(data.date) : todaysDate; - const isScheduledInFuture = scheduledDate ? scheduledDate > todaysDate : false; - const isPostInFuture = postDate > todaysDate; + const isScheduledInFuture = scheduledDate && !isNaN(scheduledDate.getTime()) ? scheduledDate > todaysDate : false; + const isPostInFuture = postDate && !isNaN(postDate.getTime()) ? postDate > todaysDate : false; return !isScheduledInFuture && !isPostInFuture; } @@ -28,9 +30,9 @@ module.exports = () => { templateClass: "tmpl-post", eleventyComputed: { eleventyExcludeFromCollections: (data) => - isCollectionVisible(data) ? (data.eleventyExcludeFromCollections || false) : true, + data && isCollectionVisible(data) ? (data.eleventyExcludeFromCollections || false) : true, permalink: (data) => { - if (!isPublished(data)) return false; + if (!data || !isPublished(data)) return false; if (data.permalink) return data.permalink; From 42942febe92fbdc16a3d6185354f3dbec3a5c14a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 08:25:03 +0000 Subject: [PATCH 4/4] fix: Inline isDev logic in posts data to prevent CI module resolution issues - Inline the logic from `_data/isdevelopment.js` directly into `posts/posts.11tydata.js` to remove the file dependency. - This ensures that `posts/posts.11tydata.js` is self-contained and avoids potential module resolution or bundling issues in CI environments (like Cloudflare Workers builds). - Maintain robustness checks for `process` and date handling. Co-authored-by: si <18108+si@users.noreply.github.com> --- posts/posts.11tydata.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/posts/posts.11tydata.js b/posts/posts.11tydata.js index 7cd8fd5..2c63a82 100644 --- a/posts/posts.11tydata.js +++ b/posts/posts.11tydata.js @@ -1,9 +1,21 @@ const todaysDate = new Date(); -const isDev = require("../_data/isdevelopment")(); + +function isDev() { + try { + if (typeof process === "undefined" || !process || !process.argv || !Array.isArray(process.argv)) { + return false; + } + return /serve|watch/.test(process.argv.join()); + } catch (e) { + return false; + } +} + +const isDevEnv = isDev(); function isPublished(data) { - if (!data) return true; // Default to published if data missing (unlikely) - if (isDev) return true; + if (!data) return true; + if (isDevEnv) return true; const isDraft = "draft" in data && data.draft !== false; return !isDraft; } @@ -12,9 +24,9 @@ function isCollectionVisible(data) { if (!data) return false; if (!isPublished(data)) return false; - if (isDev) return true; + if (isDevEnv) return true; - // Robustly handle dates, defaulting to today if missing (shouldn't happen for posts) + // Robustly handle dates const scheduledDate = "scheduled" in data && data.scheduled ? new Date(data.scheduled) : null; const postDate = data.date ? new Date(data.date) : todaysDate;