Add filter for HTML content
This commit is contained in:
parent
3c8ac5ebed
commit
6b0b772b99
10
.eleventy.js
10
.eleventy.js
@ -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 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user