Skip to content

Commit

Permalink
Fix bad ref to build.date
Browse files Browse the repository at this point in the history
  • Loading branch information
rphillips-nz committed Jul 15, 2021
1 parent e265ee8 commit 410725d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -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 = {}) {
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion cloudcannon/info.njk
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}"
Expand Down

0 comments on commit 410725d

Please sign in to comment.