[Howto] Count posts per authors in Hugo

Hi everyone. I’m just curious, my site have multiple ‘authors’ pages. Example Thomas and Tom. And they already have their posts . In their post frontmatter, i picked them an Params call tacgia(Author in English) to determine the author of the posts. Now how can i count all posts per authors have?

Thomas

---
title: "Hello World 2"
date: 2021-08-25T05:47:57+07:00
draft: false
tacgia: ["Thomas"]
---

Tom

---
title: "Hello World"
date: 2021-08-25T05:47:57+07:00
draft: false
tacgia: ["Tom"]
---

Example: In Tom page. It should be counted 2


Thomas is 1

{{ len .Pages }}

https://gohugo.io/functions/len/

4 Likes