Add filter for HTML content

master
Benji Encalada Mora 2019-10-30 13:25:58 -05:00
parent 3c8ac5ebed
commit 6b0b772b99
No known key found for this signature in database
GPG Key ID: DBEBBE9A2EB76EEB
1 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,16 @@ module.exports = function(eleventyConfig) {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
});
// Content for jsonfeed
eleventyConfig.addFilter('jsonContent', content => {
if (content) {
content = content.replace(/(\r\n|\n|\r)/gm, "");
content = content.replace(/\t/g, "\\t");
content = content.replace(/"/g, '\\"');
}
return content;
});
// Get the first `n` elements of a collection.
eleventyConfig.addFilter("head", (array, n) => {
if( n < 0 ) {