We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 82b3036 commit cb47ae2Copy full SHA for cb47ae2
1 file changed
.eleventy.js
@@ -90,6 +90,18 @@ module.exports = function(eleventyConfig) {
90
return `${months[d.getUTCMonth()]} ${d.getUTCDate()}, ${d.getUTCFullYear()}`;
91
});
92
93
+ /* Auto-blurb filter: strips HTML and truncates content */
94
+ eleventyConfig.addFilter("autoBlurb", (content, maxLength = 150) => {
95
+ if (!content) return "";
96
+ // Strip HTML tags
97
+ const text = content.replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
98
+ if (text.length <= maxLength) return text;
99
+ // Truncate at word boundary
100
+ const truncated = text.substring(0, maxLength);
101
+ const lastSpace = truncated.lastIndexOf(" ");
102
+ return (lastSpace > 0 ? truncated.substring(0, lastSpace) : truncated) + "...";
103
+ });
104
+
105
/* Set directories */
106
return {
107
dir: {
0 commit comments