I'm trying to use frontmatter to add an ID to a div but it turns into a class?

I’m having an issue where what I’m hoping will be an ID shows up as a class.

My list.html:

{{define "main"}}
     {{ range $index, $element := sort .Pages "Params.priority" "asc" }}
          {{$color := "white"}}
          {{if (modBool $index 2)}}
               {{$color = "white"}}
               {{$color = "color-block"}}
          {{if (isset .Params "bgcolor")}}
               {{$color = "red"}}
     <div id="{{.Params.title}}" class="outer-section {{.Params.bgcolor}}">
     {{ end }}

One of the content files’ frontmatter:

title: "hero"
priority: 1
draft: false
homepage: true
header: false
titleAlign: center
textAlign: center
hero: true
bgcolor: color-block

Resulting tag:

<div class="outer-section hero">

I am unable to reproduce your issue. Do you have your site code in a repo we can have a look at?

<div class="outer-section{{ with .Params.hero }} hero{{ end }}">

If hero is set to anything else than false it will show the class. If it’s not set it won’t show. If it’s set to false it won’t show.