How to grouping by categories

Which version of Hugo are you running? This works in v0.13.

$ cat layouts/index.html 
<section>
  {{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
    {{ if eq "categories" $taxonomyname }}
      {{ range $key, $value := $taxonomy }}
        <div>{{ $key }}</div>
        <ul>
        {{ range $value.Pages }}
          <li>{{ .Date }} {{ .Title }}</li>
        {{ end }}
        </ul>
      {{ end }}
    {{ end }}
  {{ end }}
</section>

Results:

$ hugo && cat public/index.html 
0 draft content 
0 future content 
4 pages created 
0 paginator pages created 
0 tags created
2 categories created
0 series created
in 8 ms
<section>
        <div>golang</div>
        <ul>
          <li>2015-03-02 19:09:18 -0600 CST golang post 2</li>
          <li>2015-03-02 19:09:12 -0600 CST golang post 1</li>
        </ul>
      
        <div>html</div>
        <ul>
          <li>2015-03-02 19:09:36 -0600 CST html post 1</li>
          <li>2015-03-02 19:09:25 -0600 CST html post 2</li>
        </ul>
</section>
5 Likes