dc5ca0d0bd
Here goes nothing...
39 lines
No EOL
969 B
JavaScript
39 lines
No EOL
969 B
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();
|
|
});
|
|
|
|
// Return your Object options:
|
|
return {
|
|
dir: {
|
|
input: "_content",
|
|
output: "pub"
|
|
},
|
|
templateFormats: ["md","html"]
|
|
}
|
|
}; |