Ok, I finally understood what was going on. I was trying this:
{{ range where .Sections ".Params.draft" "!=" true }}
...
{{ end }}
If you do that, it will list all the pages that have an _index.md file with the param draft: true. But since hugo is not building the pages that are in draft mode, it creates automatic pages for those sections. Those pages don’t have a draft parameter. So what you really have to do is:
{{ range where .Sections ".Params.draft" "!=" nil }}
...
{{ end }}
So it lists all the pages that have a draft parameter defined.
I guess you could also use a where to check if they’re really published. But in my case, it wasn’t necessary.