[solved] Wrong count of monthly posts

Thanks for this awesome generator, I’m new to it.

Now I’m debugging a theme “hugo-pacman-theme” which is not compatible greatly on new version of hugo.
I submited an issue in the repo of this theme but it seems that it is not maintained by the author for a long time, so I try to fix it by myself. Many of these compatible-problems had been fixed such as isset problem and “main” should be lowercase inSite.Menus.Main except one below.

This is the source code of the sidebar which shows the monthly counts of posts

{{ if not (eq (len .Site.Pages) 0) }}
  <div class="archiveslist">
    <p class="asidetitle">{{ .Site.Params.Strings.Archive }}</p>
    <ul class="archive-list">
      {{ range $value := (where .Site.Pages "Type" "post").GroupByDate .Site.Params.MonthFormat }}
      {{ $url := (index $value.Pages 0).Date.Format "2006-01" | urlize }}
      <li class="archive-list-item">
        <a class="archive-list-link" href="{{ $.Site.BaseURL }}post/#{{ $url }}">{{ .Key }}</a><span class="archive-list-count">{{ len $value.Pages }}</span>
      </li>
      {{ end }}
    </ul>

  </div>
{{ end }}

it works well under hugo v0.17 (demo in author’s repo) but when I use v0.20 (demo in hugo theme page), the count of first monthly posts(only first month) will always be 1 more.(“about” page doesn’t matter, because it’s not in posts and the problem still exists even this page deleted)

Is this a bug of {{ len $value.Pages }} or just a compatible problem? How can I fix it?

I noticed new feature of Site.RegularPages after hugo v0.18. And it is fixed now.