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 }}

Before you go, let's stay connected
Photo of author
About the Author
Lakshman Basnet
Digital Media Marketer from Nepal currently based in Adelaide, South Australia who apart from playing with his cat - Eleven, also enjoys developing web content, publishing blogs and YouTube videos in his free time.

Leave a comment