List all posts but drafts

Hi

I’d like to generate the drafts but not list them on my main page.

I tried this, which doesn’t work (returns an empty list):

 {{ range first 10 (where .Data.Pages "Draft" false) }}

What’s the correct solution?

Thanks!

He want them “published”, but not on the home page.

Ah good point, I didn’t know I could do that, thanks.

I’m still interested in knowing the syntax to test a boolean in the template where thing however (out of curiosity).

I misunderstood, you’re right bep, I want them built/published actually.

@bep @jlaumon Hencr why I withdrew the post before anyone else responded…

I can never seem to get multiple where loop conditions to work. So, rather than tear what’s left of my hair out trying, I’d just take the easier option of nesting the loop:

{{ range where .Data.Pages "Type" "post" }}
{{ if ne .Draft true}}

/// post display code

{{ end }}
{{end}}

Just nest the where.

Thanks, it works