Displaying post count in Jekyll

Displaying post count in Jekyll can be achieved by using the size command.

Jekyll is a very popular static site generator built in Ruby and can be used for diverse purposes like for blogs, projects and portfolios.

Display the total number of posts in a site

We can display the total number of all posts or in particular with the following code.

{{ site.posts | size }}

Post count in category

To display the number of posts in particular categories in Jekyll site, we can use CAT with size

{{ site.categories.CAT | size }}