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.2k stars 2.9k forks source link

Latest Hugo version, 0.72.0, crashes due to logical error. One line fix provided. #1733

Closed johnheenan closed 4 years ago

johnheenan commented 4 years ago

Describe the bug

Latest hugo version, 0.72.0, crashes with hugo-academic

ERROR 2020/06/06 20:20:20 render of "page" failed: "...\themes\academic\layouts\publication\single.html:14:10": execute of template failed: template: publication/single.html:14:10: executing "main" at <(.Params.publication_types) and (ne (index .Params.publication_types 0) "0")>: 
can't give argument to non-function .Params.publication_types

To Reproduce

hugo

Expected behavior

Does not crash.

Technical details:

The Go template package was updated and fixed a bug which correctly marks a logical error in line 14 of themes\academic\layouts\publication\single.html

Fix

Change line 14 in above file from

 {{ if (.Params.publication_types) and (ne (index .Params.publication_types 0) "0") }}

to

{{ if and (.Params.publication_types) (ne (index .Params.publication_types 0) "0") }}

Reference

https://discourse.gohugo.io/t/cant-give-argument-to-non-function/26028

John Heenan

gcushen commented 4 years ago

Thanks, this was already fixed. Duplicate of #1715

johnheenan commented 4 years ago

It is a bit if a stretch to say this is fixed when the fix is not in a release.

Gitlab and github users currently using CI/CD (Continuous Integration/Continuous Deployment) are affected.

As soon as I got a gitlab CI/CD build error I checked if I was using the latest release of hugo-academic. I confirmed I was.

It is not reasonable to expect me and other users to look beyond release to fix such a production issue bug.

Of course hugo-academic is superbly imaginative use of hugo templating.

Johh Heenan

gcushen commented 4 years ago

You can find the compatible Hugo version for the Academic version you have in themes/academic/theme.toml under min_version.

johnheenan commented 4 years ago

I may not have got my point across.

The min_version listed of Hugo is 0.62 in theme.toml is not relevant to the issue.

There is no listed max_version of Hugo.

What is relevant is that the current production release version of Hugo, 0.72.0, used in gitlab CI/CD, causes a build crash using the current production release version of hugo-academic, v4.8.0.

That is it.

There is now another issue arising in hugo-academic of expecting CI/CD production level users to look beyond production level releases of hugo-academic to prevent a build crash when CI/CD uses the production level version of Hugo build software.

Of course we can ensure CI/CD does not use the latest production release of build software. But it is clumsy and adds additional unwanted complexity.

John Heenan