<SOLVED> Ranging throough different sections

Hi all - a little stuck here (I’m new to Hugo)

I have a ficticious site that’s ste out the following way…

Home
Easy Walks
  ---- walk A
  ---- walk B
  ---- walk C
Difficult Walks
  ---- walk D
  ---- walk E
Adventure Walks
  ---- walk F
  ---- walk G
Contact

On the front-matter of some I have “featured: true” - I now want to range through the first 3 of all pages that featured is true and display on the index page.

I tried this…

{{ range first 3 (where .Pages ".Params.Featured" "true")}}
<h1>{{ .Title }}</h1>
{{ end }}

I also tried .Site.Pages - but it doesn’t work.

When I run Hugo server, I don’t get any error messages, I simply don’t get the data from .Title - so I assume I’m simply not calling the .Title correctly but can’t see my error.

Thanks

Have you tried removing the quotes around "true"? It may be trying to match to a string value "true" instead of the boolean.

oops, I should have pointed that out in the original post… I did try, made no difference.

Not sure if knowing what version of Hugo I’m using will make a difference, but it’s “v0.54”.

Also try .Params.featured (ie lowercase F)

Page-level .Params are only accessible in lowercase.

ref: https://gohugo.io/variables/page/#page-level-params

Oh my word… I should have known that right away!!

:roll_eyes:

Thank you, it works :slight_smile: