# Does .NextInSection work?

**URL:** <https://discourse.gohugo.io/t/does-nextinsection-work/957>\
**Category:** support\
**Created:** [March 25, 2015, 4:48am UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957 "2015-03-25T04:48:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![grex84](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grex84/32/321_2.png) [@grex84](https://discourse.gohugo.io/u/grex84)\
**Post date:** [March 25, 2015, 4:48am UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/1 "2015-03-25T04:48:05Z")

</div>

I am trying to place the {{.NextInSection}} in the section list template and i am getting as a result.

I even tried this on a fresh website with 2 content pages in a section called posts and am trying to call the {{.NextInSection}} in the default/single.html file.

Am i missing something??

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 25, 2015, 10:28am UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/2 "2015-03-25T10:28:01Z")

</div>

Works fine for me.

You are a little bit unclear about what you get and what you expect.

---

<div class="post-metadata">

**Author:** ![grex84](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grex84/32/321_2.png) [@grex84](https://discourse.gohugo.io/u/grex84)\
**Post date:** [March 25, 2015, 11:20am UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/3 "2015-03-25T11:20:05Z")

</div>

I get nil as a value. Sorry, Nil is enclosed in html tag brackets which is not showing up in this comment editor because it is being interpreted as html.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 25, 2015, 11:25am UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/4 "2015-03-25T11:25:16Z")

</div>

Me too get nil as value when there is no next or prev.

Mentally this feature (same as Prev and Next) is a llitle backward … as next is older.

---

<div class="post-metadata">

**Author:** ![grex84](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grex84/32/321_2.png) [@grex84](https://discourse.gohugo.io/u/grex84)\
**Post date:** [March 25, 2015, 11:28am UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/5 "2015-03-25T11:28:46Z")

</div>

But I do have an older page within the section. I have 2 content pages. NextInSection on the newer page gives me nil and PrevInSection on this page doesn’t give me anything at all.

---

<div class="post-metadata">

**Author:** ![grex84](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grex84/32/321_2.png) [@grex84](https://discourse.gohugo.io/u/grex84)\
**Post date:** [March 25, 2015, 11:31am UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/6 "2015-03-25T11:31:25Z")

</div>

I actually get the opposite effect on the second page. NextInSection gives me nothing while PrevInSection gives me that nil value.

I feel like Im missing something. The only front matter i put in was a title and date.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 25, 2015, 11:48am UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/7 "2015-03-25T11:48:25Z")

</div>

You would have to put a failing project out in the open (GitHub?) for anyone to be able to guess whats up.

---

<div class="post-metadata">

**Author:** ![grex84](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grex84/32/321_2.png) [@grex84](https://discourse.gohugo.io/u/grex84)\
**Post date:** [March 25, 2015, 12:23pm UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/8 "2015-03-25T12:23:53Z")

</div>

Do you have a typical example of how this should be done or a working project where this feature is being used so i can take a look myself? If not, I’ll check on Github.

Thanks

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 25, 2015, 12:39pm UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/9 "2015-03-25T12:39:58Z")

</div>

Hmm… I notice now that .NextInSection works kind of differently from .Next.

This works for me:

```auto
 <a class="btn btn-lg cc-btn-default{{if not .PrevInSection}} disabled{{end}}" href="{{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}">Older</a>
      <a class="btn btn-lg cc-btn-default{{if not .NextInSection}} disabled{{end}}" href="{{if .NextInSection}}{{.NextInSection.Permalink}}{{end}}">Newer</a>

```

---

<div class="post-metadata">

**Author:** ![grex84](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grex84/32/321_2.png) [@grex84](https://discourse.gohugo.io/u/grex84)\
**Post date:** [March 25, 2015, 1:07pm UTC](https://discourse.gohugo.io/t/does-nextinsection-work/957/10 "2015-03-25T13:07:03Z")

</div>

Thanks bjornerik.This works for me now. Much appreciated.
