"len" in shortcode stopped working in 0.35

I use shortcodes on my site to count the number of entries in data files:

{{ .Site.Data.books | len }}

and use them in my Markdown files like this:

This section has {{< count_books >}} books.

This stopped working in Hugo 0.35 and I can’t figure out how to fix the issue:

Building sites … ERROR 2018/02/03 11:05:14 error processing shortcode "shortcodes/count_books.html" for page "books.md": template: shortcodes/count_books.html:1:22: executing "shortcodes/count_books.html" at <len>: wrong number of args for len: want 1 got 0

If you data format is JSON, I suspect this is it:

It is fixed in the source, we have added tests so it does not happen again, and will cut a new Hugo release with this fix on Monday.

Thank you a lot for the information, that’s most likely the issues. My data is JSON.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.