jekyll-pluralize
A plugin to make an simple pluralize with Jekyll.
installation
Add this line to your application's Gemfile
gem 'jekyll-pluralize'and add this line in your application's _config.yml :
# _config.yml
plugins:
- jekyll-pluralizeUsage
In you html file, use liquid syntax with :
{{ number | pluralize: 'singular', 'plural' }}with singular and plural words
If page.posts.size = 1 or page.posts.size = 0
<span>
{{ page.post.size }}
{{ page.post.size | pluralize: 'post', 'posts' }}
</span>render :
<span>
1 post or 0 post
</span>If page.posts.size >= 2
<span>
{{ page.post.size }}
{{ page.post.size | pluralize: 'post', 'posts' }}
</span>render :
<span>
2 posts
</span>with singular and without plural words
If page.posts.size = 1 or page.posts.size = 0
<span>
{{ page.post.size }}
{{ page.post.size | pluralize: 'post' }}
</span><span>
1 post or 0 post
</span>If page.posts.size >= 2
<span>
{{ page.post.size }}
{{ page.post.size | pluralize: 'post' }}
</span>render :
<span>
2 posts
</span>