String Comparison issue in template partial

Moved from GitHub on request https://github.com/gohugoio/hugo/issues/4072#issuecomment-343437165

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

To the eq function, type matters: so:

{{ eq true “true” }} = > false
{{ eq true true }} = > true

I was unaware boolean literals were available in templates. Looks like that fixed the issue, thanks!