Merge pull request #48 from benjifs/jsonfeed

JSON Feed
This commit is contained in:
Zach Leatherman
2020-07-27 11:30:43 -05:00
committed by GitHub
4 changed files with 51 additions and 0 deletions

View File

@@ -24,6 +24,14 @@ module.exports = function(eleventyConfig) {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
});
// Content for jsonfeed
eleventyConfig.addFilter('jsonStringify', content => {
if (!content) {
content = "";
}
return JSON.stringify(content);
});
// Get the first `n` elements of a collection.
eleventyConfig.addFilter("head", (array, n) => {
if( n < 0 ) {