From 76d847991522eb39c5260d88ed194ea987c5acfd Mon Sep 17 00:00:00 2001 From: James Doc Date: Tue, 10 Sep 2024 13:26:19 +0100 Subject: [PATCH] Conditionally add students to the main nav --- .eleventy.js | 2 ++ src/_includes/blocks/header.njk | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/.eleventy.js b/.eleventy.js index dbebf31..3992528 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -53,6 +53,8 @@ module.exports = function (eleventyConfig) { eleventyConfig.addPassthroughCopy({"src/_assets/img/passThrough/the-globe-church-og.jpg": "_assets/img/the-globe-church-og.jpg"}); eleventyConfig.addPassthroughCopy({"src/_assets/img/passThrough/**": "assets/img/passThrough"}); + eleventyConfig.addGlobalData("buildDate", new Date()); + return { templateFormats: ["html", "njk", "md", "11ty.js"], pathPrefix: "/", diff --git a/src/_includes/blocks/header.njk b/src/_includes/blocks/header.njk index 2867ab5..11c573c 100644 --- a/src/_includes/blocks/header.njk +++ b/src/_includes/blocks/header.njk @@ -1,3 +1,5 @@ +{% set currentMonth = buildDate.getMonth() + 1 %} + Skip to site content @@ -55,6 +57,10 @@ Preaching Church Blog Get Involved + {# conditionally show if July–October #} + {% if (currentMonth > 7) and (currentMonth < 11) %} + Students + {% endif %} Contact