Find the number of items in a data file

Hey everyone. If I had a data file of TV episodes that looked something like this:

File: /data/the-show/season-1.yaml

- episode: 100
  name: "Episode 1: The craziness"
  description: "The description of episode 1."
- episode: 101
  name: "Episode 2: The craziness Returns"
  description: "The description of episode 2."

How would I be able to determine the number of episodes in the season within a Hugo template? I didn’t see a sort of count, length, or arraysize function in the docs.

The only idea I have to do this so far would be to “range” through the episodes, create a counter, and store that in scratch to use afterward. I’m hoping someone has a better idea. Thanks.

1 Like
2 Likes

:angry: That really sucks. Don’t know how I missed that. Thank you.