death.id.au/.eleventy.js
Gordon Pedersen a346517f02 have 11ty pass through img, js, css
also fix some urls and delete the original index.html (now in _content anyway)
2022-11-30 21:21:48 +11:00

42 lines
No EOL
1 KiB
JavaScript

module.exports = function(eleventyConfig) {
eleventyConfig.addFilter("formatDate", function(value) {
try{
const date = new Date(value)
if(date) return date.toISOString().replace('T', ' ').slice(0, -5)
else throw 'Unrecognized data format'
}
catch(e) {
console.log(`Could not convert "${value}"`, e)
return value;
}
});
eleventyConfig.addFilter("dateISOString", function(value) {
try{
const date = new Date(value)
if(date) return date.toISOString()
else throw 'Unrecognized data format'
}
catch(e) {
console.log(`Could not convert "${value}"`, e)
return value;
}
});
eleventyConfig.addCollection("notes", function(collectionApi) {
return collectionApi.getFilteredByGlob("_content/notes/*.md").reverse();
});
eleventyConfig.addPassthroughCopy("img");
eleventyConfig.addPassthroughCopy("js");
// Return your Object options:
return {
dir: {
input: "_content",
output: "pub"
},
templateFormats: ["md","html"]
}
};