Custom metadata behaves different in where filter

My front matters looks like this:

Post0.md

---
title: "I am a title"
isEdit: 0
---
I am post zero!

Post1.md

---
title: "I am a title"
isEdit: 1
---
I am post one! My isEdit value is 1!
{{ $pages := where (where .Site.RegularPages "Type" "posts") ".Params.isEdit" "!=" 1 }}
{{ range (.Paginate $pages).Pages }}
    {{ .Title }}
{{ end }}

The above range does not properly filter out posts that have isEdit: 1. However, if I change isEdit to isedit, it works as expected.

{{ $pages := where (where .Site.RegularPages "Type" "posts") ".Params.isedit" "!=" 1 }}

In my template, whilst “ranging”, if I have:

{{ if eq .Params.isEdit 1}}<span>Ok</span>{{ end }}

The span element will render properly.

This isn’t a huge deal for me, as I can change the frontmatter to be all lowercase, but I thought I would see if this is a known issue.

I found these threads, but they seem to suggest this was an older bug that was resolved:

Which version are you running? Type hugo version.

Sorry, I forgot to include that.

hugo v0.82.1+extended darwin/amd64

Upgrade to v0.83.1. The issue you describe was fixed with:
https://github.com/gohugoio/hugo/commit/bca40cf0c9c7b75e6d5b4a9ac8b927eb17590c7e

1 Like

Thank you!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.