diff --git a/src/_config/filters.js b/src/_config/filters.js index 3f31743a..876faf79 100644 --- a/src/_config/filters.js +++ b/src/_config/filters.js @@ -15,6 +15,11 @@ export default function(eleventyConfig) { return array.slice(0, limit); }); + // Thousands separator + eleventyConfig.addFilter("thousands", function(num) { + return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + }); + // Filter blog posts by category eleventyConfig.addFilter("filterByCategory", function(posts, cat) { cat = cat.toLowerCase(); diff --git a/src/_includes/global/content.njk b/src/_includes/global/content.njk index 61d3e60f..1d0d4dd7 100644 --- a/src/_includes/global/content.njk +++ b/src/_includes/global/content.njk @@ -11,7 +11,7 @@ layout: global/base

{{ desc }}

- {{ content | wordcount }} words. + {{ content | wordcount | thousands }} words. Posted: {{ date | niceDate }} by {{ sitemeta.siteAuthor.name }}

{% if updated %}