Moved from GitHub on request String Comparison issue in template partial · Issue #4072 · gohugoio/hugo · GitHub
Looks like there’s a very strange issue with string comparison, primarily when reading directly from frontmatter.
{{ .Params.force_summary }} # true
{{ base64Encode .Params.force_summary }} # dHJ1ZQ==
{{ base64Encode "true" }} # dHJ1ZQ==
{{ eq .Params.force_summary "true" }} # false
{{ eq (base64Encode "true") (base64Encode .Params.force_summary) }} # true
---
title: Doesn't matter
force_summary: true
---
This code is run inside a partial. It’s possible this is because true
is some kind of reserve word in the comparison, i’m not familiar with the templating engine.
Hugo Static Site Generator v0.30.2 linux/amd64 BuildDate: 2017-10-21T12:44:04+02:00