Help with dates logic

I’m trying to build an article list that lists the year, and then all articles written in that year under it. Using handlebars, I can’t figure out how to do this. Is there any way I can add some logic to make this happen? A “do while” loop would do that trick but I’m not sure “do while” loops are possible in Ghost. Is there any way to add JS functionality to my template?

Incase my example isn’t clear, a good example of what I’m trying to accomplish can be found here: https://jamesclear.com/articles

2019
December 1 Article Title
Novemver 24 Article Title
October 9 Article Title
July 14 Article Title
February 2 Article Title

2018
December 1 Article Title
Novemver 24 Article Title
October 9 Article Title
July 14 Article Title
February 2 Article Title

2017
December 1 Article Title
Novemver 24 Article Title
October 9 Article Title
July 14 Article Title
February 2 Article Title

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.