Trouble with GitLab Pages - template error

I’m switching a couple sites from WordPress to Hugo on GitLab. I’m trying to get a second blog running, but I’m getting an error when it tries to build.

gitlab-ci-multi-runner 1.3.2 (0323456)
Using Docker executor with image publysher/hugo ...
Pulling docker image publysher/hugo ...
Cloning into '/builds/JohnBlood/manjaro-rocks-blog'...
Running on runner-8a2f473d-project-1396159-concurrent-0 via runner-8a2f473d-machine-1470242460-e7811da1-digital-ocean-4gb...
Cloning repository...
Checking out 5b1c3c26 as master...
$ hugo
Started building site
ERROR: 2016/08/03 16:49:08 template.go:131: template: theme/_default/single.content.html:5:54: executing "theme/_default/single.content.html" at <len>: wrong number of args for len: want 1 got 0 in theme/_default/single.content.html
0 draft content
0 future content
1 pages created
0 non-page files copied
2 paginator pages created
0 tags created
0 categories created
in 73 ms

ERROR: Build failed: exit code 1

You can find my repo here: https://gitlab.com/JohnBlood/manjaro-rocks-blog. Here is my config file (I just started on this blog): https://gitlab.com/JohnBlood/manjaro-rocks-blog/blob/master/config.toml. Here is the output link: https://johnblood.gitlab.io/manjaro-rocks-blog/

Any help would be appreciated.

According to the error message the problem can be found in line 5 in the single.content.html template.

{{ $categoryCount := .Params.categories | len }}

It seems that some of your content files don’t define any categories in the frontmatter. Therefore, the value of categories is nil and nil | len would cause an error.

First, I would check with isset, if the variable is set or not in order to prevent the error message.

I added a category and now it builds successfully. Thanks

I’ll probably be back very soon with simple noob questions. :slightly_smiling: