Showing related posts based on the category of current post in Jekyll

— Lately, I wanted to show related posts on post pages based on the category the current post lies in. So, for instance, of the post belongs to the “Jekyll” category, I would fetch the recent five posts published under this category and show those on the post. In my case, as you can tell, I’ve shown it in the right sidebar under More in "Jekyll" label.