lewisdale.dev/config/filters/excerpt.js
2023-12-26 14:35:09 +00:00

6 lines
235 B
JavaScript

module.exports = function (eleventyConfig) {
eleventyConfig.addFilter('excerpt', (content, limit = 250) => {
const excerpt = content.replace(/(<([^>]+)>)/gi, "").slice(0, limit) + " […]";
return excerpt;
});
}