Front Matter false, False, FALSE and FAlse

I’m aware that in front matter we just have strings - no real boolen.
There is probably a kind of “type casting” involved.
Edit: see: Boolean Language-Independent Type for YAML™ Version 1.1

We have: Templating | Hugo

Go Templates treat the following values as false:
false
0
any zero-length array, slice, map, or string

Given in front matter

foo: false

leads to boolen false. False as well - and also FALSE.
But not
FAlse (FALse, FALSe, fAlse, …)
So there is no “lower” involved.

Is this intentionally done?
Looks like FAlse is converted into a string “FAlse” which is, being no-zero-length, true.

Hugo Static Site Generator v0.33 linux/amd64 BuildDate: 
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.9.2"

That is not true (pun intended).

YAML, TOML and JSON all supports boolean values:

bepIsSmart = true

The above is truthful in more than one way (pun intended).

1 Like

?
true in the file is stored as (hex)
74727565

What do you mean by “stored as”? Are you looking at the raw memory dump?

I was referring to true and false in front matter and my statement: “no real boolean”.

iMustBe: "a fool"

=> I get a String

iMustBe: false
{ if .Params.iMustBe }} => evaluates to false
iMustBe: FAlse

=> evaluates to true

(FALse gets converted into a String, non empty => true)

But hej - now I saw:
http://yaml.org/type/bool.html

y|Y|yes|Yes|YES|n|N|no|No|NO
|true|True|TRUE|false|False|FALSE
|on|On|ON|off|Off|OFF

These are defined boolean values - I just missed those one’s :roll_eyes: )

And after seeing:
http://yaml.org/type/str.html

This tag accepts all scalar values. It is is typically used as the fall-back tag for scalar nodes.

The magic is gone and all clear…