Add thousands separator filter
This commit is contained in:
parent
c179700a08
commit
2b02329cd2
|
@ -24,4 +24,9 @@ export default function(eleventyConfig) {
|
|||
eleventyConfig.addFilter("itemLimit", function(array, itemLimit) {
|
||||
return array.slice(0, itemLimit);
|
||||
});
|
||||
|
||||
// Thousands separator
|
||||
eleventyConfig.addFilter("thousands", function(num) {
|
||||
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
});
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
{% if isArticle %}
|
||||
<div class="article__info">
|
||||
<p class="article__info--desc">{{ desc }}</p>
|
||||
<p>{{ content | wordcount }} words. Posted on {{ date | formatDate }} by {{ sitemeta.siteAuthor.name }}</p>
|
||||
<p>{{ content | wordcount | thousands }} words. Posted on {{ date | formatDate }} by {{ sitemeta.siteAuthor.name }}</p>
|
||||
{% if updated %}
|
||||
<p>Last updated on {{ updated | formatDate }}</p>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue