diff --git a/.eleventy.js b/.eleventy.js index ab84680..0e73ed4 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,5 +1,7 @@ const pkginfo = require('pkginfo')(module, 'version'); + const version = module.exports.version; +const time = new Date().toISOString(); // defaultConfig should match the return value from https://www.11ty.dev/docs/config/ module.exports = function (eleventyConfig, defaultConfig = {}) { @@ -15,6 +17,7 @@ module.exports = function (eleventyConfig, defaultConfig = {}) { } } + eleventyConfig.addNunjucksShortcode('ccTime', () => time); eleventyConfig.addNunjucksShortcode('ccPath', (key) => (config.dir[key] ?? '').replace(/^\.\/?/, '')); eleventyConfig.addNunjucksShortcode('ccConfig', (key) => JSON.stringify(config[key] ?? '')); eleventyConfig.addNunjucksShortcode('ccVersion', () => version); diff --git a/cloudcannon/info.njk b/cloudcannon/info.njk index add4673..c8ab04c 100644 --- a/cloudcannon/info.njk +++ b/cloudcannon/info.njk @@ -8,7 +8,7 @@ permalink: /_cloudcannon/info.json {%- set includesPath %}{% ccPath 'includes' %}{% endset -%} {%- set layoutsPath %}{% ccPath 'layouts' %}{% endset -%} { - "time": "{{ build.date.toISOString() }}", + "time": "{% ccTime %}", "cloudcannon": { "name": "eleventy-plugin-cloudcannon", "version": "{% ccVersion %}"