No commit activity in last 3 years
No release in over 3 years
pluralize liquid filter for Jekyll
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 13.0.1
~> 3.5
~> 0.71
 Project Readme

jekyll-pluralize

Build Status

Gem Version 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-pluralize

Usage

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>