HugoBlox / hugo-blox-builder

🚨 GROW YOUR AUDIENCE WITH HUGOBLOX! 🚀 HugoBlox is an easy, fast no-code website builder for researchers, entrepreneurs, data scientists, and developers. Build stunning sites in minutes. 适合研究人员、企业家、数据科学家和开发者的简单快速无代码网站构建器。用拖放功能、可定制模板和内置SEO工具快速创建精美网站!
https://hugoblox.com/templates/
MIT License
8.28k stars 2.91k forks source link

error calling len: len of untyped nil #145

Closed instantwifi closed 7 years ago

instantwifi commented 7 years ago

I get this error with Hugo v 0.19:

ERROR 2017/04/04 11:24:47 theme/partials/article_metadata.html template: theme/partials/article_metadata.html:12:23: executing "theme/partials/article_metadata.html" at <len $.Params.categor...>: error calling len: len of untyped nil

I am using all the content from the example folder.

What would be the easiest fix for this?

instantwifi commented 7 years ago

Fixed by adding categories = [] to posts.

gcushen commented 7 years ago

Hi @instantwifi . Thanks for reporting this. If there's an incompatibility with the latest Hugo version then we should re-open this issue and apply your fix to the master code.

However, I'm using Hugo v0.19 (installed via Brew on Mac) and don't see this error when creating the example site as per the installation guide.

Please could you paste the output of running hugo version so I can see the details of the version you are using? Thanks!

fischcheng commented 7 years ago

I found a similar issue on v0.29. The same contents works for the older version of Hugo-academic theme, but not the latest version. Mine shows tag instead:

Error while rendering "home": template: theme/index.html:13:9: executing "theme/index.html" at <partial $widget $par...>: error calling partial: template: theme/partials/widgets/posts.html:25:14: executing "theme/partials/widgets/posts.html" at <len $page.Params.tag...>: error calling len: len of untyped nil

fischcheng commented 7 years ago

Fixed it by compared to the example site: in /content/home/posts.md there are now filters: tags_include = [] tags_exclude = []

It was a simple tag=[] before.

gcushen commented 7 years ago

This is mentioned in the release notes: https://sourcethemes.com/academic/post/v0.30.0/

fischcheng commented 7 years ago

Thank you for the great work. I'll pay more attention to the release note next time!

pjox commented 7 years ago

I'm getting the same problem with the latest commit, this time it seems to be related to the projects (Hugo v0.29):

ERROR 2017/10/10 00:24:24 Error while rendering "home": template: theme/index.html:13:9: executing "theme/index.html" at <partial $widget $par...>: error calling partial: template: theme/partials/widgets/projects.html:18:14: executing "theme/partials/widgets/projects.html" at <len $page.Params.fil...>: error calling len: len of untyped nil

In fact, the page is not building at all.

gcushen commented 7 years ago

@pjox could it be that you have not updated the parameters in the Projects widget? See https://sourcethemes.com/academic/post/v0.30.0/ RE the new parameters

pjox commented 7 years ago

@gcushen, no I actually updated the the parameters in the Projects widget by adding filter_default = 0 and I checked the frontmatter of content files for any differences but I couldn't find any. Could it be because I'm not using the filters? Or because I'm only using one external project? I'm attaching the files in question (I had to change the files' extensions to .txt in order to attach them). Thank you!

projects.txt OuterSpace.txt

gcushen commented 7 years ago

@pjox thanks for providing the files to reproduce the issue of an error occurring when there are no project filters specified in the project widget. I can confirm that it is a bug caused by one of the other v2 commits. I opened a specific issue for this (#306) and it has now been resolved - please update your Academic and let me know if you experience any further issues :)

pjox commented 7 years ago

@gcushen I can confirm it is now working. Thank you so much! :smile:

Salfo commented 7 years ago

Dear, I am experiencing similar issues as stated above. I was able to create my website and deploy it. But, after I try to create a new post, blogdown:::serve_site() produces an error message. After reading this thread, I tried to update the theme as suggested above, and I get the message "Already up-to-date." below is the complete error message. Any help? Thank you for your consideration.

blogdown:::serve_site() Started building sites ... ERROR 2017/10/30 21:59:58 Error while rendering "home": template: theme/index.html:13:9: executing "theme/index.html" at <partial $widget $par...>: error calling partial: template: theme/partials/widgets/projects.html:64:84: executing "theme/partials/widgets/projects.html" at <delimit .Params.tags...>: error calling delimit: can't iterate over Started building sites ... ERROR 2017/10/30 21:59:58 Error while rendering "home": template: theme/index.html:13:9: executing "theme/index.html" at <partial $widget $par...>: error calling partial: template: theme/partials/widgets/projects.html:64:84: executing "theme/partials/widgets/projects.html" at <delimit .Params.tags...>: error calling delimit: can't iterate over The system cannot find the path specified. Error in shell(cmd, mustWork = TRUE, intern = intern) : '"C:\Users\Salfo\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-academic' execution failed with error code 1 In addition: Warning messages: 1: running command '"C:\Users\Salfo\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-academic' had status 65535 2: running command '"C:\Users\Salfo\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-academic' had status 65535 3: running command 'C:\WINDOWS\system32\cmd.exe /c "C:\Users\Salfo\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-academic' had status 1