# How to call even or odd numbered pages using range funtion in hugo

**URL:** <https://discourse.gohugo.io/t/how-to-call-even-or-odd-numbered-pages-using-range-funtion-in-hugo/4501>\
**Category:** support\
**Created:** [November 7, 2016, 4:18pm UTC](https://discourse.gohugo.io/t/how-to-call-even-or-odd-numbered-pages-using-range-funtion-in-hugo/4501 "2016-11-07T16:18:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiran-nani](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kiran-nani/32/2216_2.png) [@kiran-nani](https://discourse.gohugo.io/u/kiran-nani)\
**Post date:** [November 7, 2016, 4:18pm UTC](https://discourse.gohugo.io/t/how-to-call-even-or-odd-numbered-pages-using-range-funtion-in-hugo/4501/1 "2016-11-07T16:18:36Z")

</div>

I am fine with {{ range first 10 .Data.Pages }} but when I want to call some specific numbered posts or specific range, its hard to me to write the code. How to call custom pages using range function?

---

<div class="post-metadata">

**Author:** ![sairam](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/sairam/32/2198_2.png) [@sairam](https://discourse.gohugo.io/u/sairam)\
**Post date:** [November 7, 2016, 5:35pm UTC](https://discourse.gohugo.io/t/how-to-call-even-or-odd-numbered-pages-using-range-funtion-in-hugo/4501/2 "2016-11-07T17:35:46Z")

</div>

If you want to loop through a set of specific pages, here is the code with explanation.  
You could try modifying this if you have a custom archetype or variable with similar parameters like the `Post DateTime` or if you have numbered the posts.

Try if you can use `.NextInSection` recursively.  
documentation: [https://gohugo.io/templates/variables/](https://gohugo.io/templates/variables/)

* * *

Add a new param inside your content/post/test.md inside the `+++`

```auto
see_also = ["file-name-4", "file-6"]

```

Now in your single.html add the following -

```auto
  {{ if isset .Params "see_also" }}
  {{ $seeAlso := index .Params "see_also" }}
  <h4>See Also</h4>
  <ul>
    {{ range where .Site.Pages "Section" .Section }}
    {{ if in $seeAlso .File.BaseFileName }}
      <li><a href="{{ .RelPermalink }}" alt="{{ .Title }}">{{ .LinkTitle }}</a></li>
    {{ end }}
    {{ end }}
  </ul>
  {{ end }}

```

1. First checks if the param see\_also is set in the markdown/html file (in the `content` directory)
2. We iterate through all Pages in the current `Section` (otherwise, it will use all the pages in the current project)
3. Matches the list based on the filename
4. Display the link
