# Order & range by a specified params value

**URL:** <https://discourse.gohugo.io/t/order-range-by-a-specified-params-value/5214>\
**Category:** support\
**Created:** [January 21, 2017, 12:42am UTC](https://discourse.gohugo.io/t/order-range-by-a-specified-params-value/5214 "2017-01-21T00:42:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![inspiritana](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inspiritana/32/1965_2.png) [@inspiritana](https://discourse.gohugo.io/u/inspiritana)\
**Post date:** [January 21, 2017, 12:42am UTC](https://discourse.gohugo.io/t/order-range-by-a-specified-params-value/5214/1 "2017-01-21T00:42:38Z")

</div>

Hello,

I want to create a selected “featured” post section, with an order I can specify manually.

So in the frontmatter of an article I would set the Params “featured”:

> +++  
> featured = “1”  
> +++

with values of 5 to 1.

Then I want to range the first 5 articles that have a value set for .Params.featured, ordered from 5 to 1.

However, I even fail at the first step, namely just ranging 5 articles that have the Params set. I tried this:

> {{ range first 5 (where .Site.Pages.ByDate “Params.featured” “1”) }}

but for some reason it just displays 1 post. Hugo does not give me any error message…

Any ideas what I’m doing wrong?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Mikhail](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mikhail/32/1138_2.png) [@Mikhail](https://discourse.gohugo.io/u/Mikhail)\
**Post date:** [January 21, 2017, 10:14am UTC](https://discourse.gohugo.io/t/order-range-by-a-specified-params-value/5214/2 "2017-01-21T10:14:59Z")

</div>

[Look this](https://discuss.gohugo.io/t/strange-syntax-of-the-function-where/4432)

---

<div class="post-metadata">

**Author:** ![inspiritana](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inspiritana/32/1965_2.png) [@inspiritana](https://discourse.gohugo.io/u/inspiritana)\
**Post date:** [January 21, 2017, 7:01pm UTC](https://discourse.gohugo.io/t/order-range-by-a-specified-params-value/5214/3 "2017-01-21T19:01:55Z")

</div>

According to the linked post, I tried out:

> {{ range first 5 (where .Site.Pages “Params.featured” 1) }}

but this does not give me any posts at all…

---

<div class="post-metadata">

**Author:** ![Mikhail](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mikhail/32/1138_2.png) [@Mikhail](https://discourse.gohugo.io/u/Mikhail)\
**Post date:** [January 22, 2017, 9:20am UTC](https://discourse.gohugo.io/t/order-range-by-a-specified-params-value/5214/4 "2017-01-22T09:20:40Z")

</div>

I think that for debugging, you need to remove “first” and making work correctly “where”. Try this:

```auto
where $.Site.Pages "Params.featured" "=" 1

```

Or do other experiments with this string.

---

<div class="post-metadata">

**Author:** ![inspiritana](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inspiritana/32/1965_2.png) [@inspiritana](https://discourse.gohugo.io/u/inspiritana)\
**Post date:** [January 22, 2017, 11:22pm UTC](https://discourse.gohugo.io/t/order-range-by-a-specified-params-value/5214/5 "2017-01-22T23:22:05Z")

</div>

Thank you!

I tried out a bit and found out that  
`{{ range first 5 (where $.Site.Pages "Params.featured" "=" "1") }}`  
does work as desired.

Now I’ll have to to figure out how I can set different values for the Params.featured (1-5) and order the results.
