Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ module.exports = function (eleventyConfig) {
return encodeURIComponent(str);
});

eleventyConfig.addFilter("toRomanNumerals", function (num) {
const vals = [1000,900,500,400,100,90,50,40,10,9,5,4,1];
const syms = ["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"];
let result = "";
for (let i = 0; i < vals.length; i++) {
while (num >= vals[i]) { result += syms[i]; num -= vals[i]; }
}
return result;
});

eleventyConfig.addFilter("cssmin", function (code) {
return new CleanCSS({}).minify(code).styles;
});
Expand Down
3 changes: 3 additions & 0 deletions _data/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
year: new Date().getFullYear(),
};
2 changes: 1 addition & 1 deletion _includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
</main>

<footer>
&copy; MCMLXXX
&copy; <abbr title="{{ build.year }}">{{ build.year | toRomanNumerals }}</abbr>
<a href="/about/">{{ metadata.author.name }}</a>
<a href="/site-index/">Index</a>
</footer>
Expand Down
Loading