# Pagination across sections

**URL:** <https://discourse.gohugo.io/t/pagination-across-sections/44218>\
**Category:** support\
**Created:** [May 5, 2023, 2:29pm UTC](https://discourse.gohugo.io/t/pagination-across-sections/44218 "2023-05-05T14:29:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tedcm](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@tedcm](https://discourse.gohugo.io/u/tedcm)\
**Post date:** [May 5, 2023, 2:29pm UTC](https://discourse.gohugo.io/t/pagination-across-sections/44218/1 "2023-05-05T14:29:56Z")

</div>

I have 3 sections in my blog. With my pager template, the next and previous only move in the current section.

What I’m trying to do is for it to move across 3 sections.

Here is the template:

```auto
{{- if .Param "pager" }}
{{- if or (.PrevInSection) (.NextInSection) }}
<nav class="pager flex">
	{{- if .PrevInSection }}
	<div class="pager __item pager__ item--prev">
		<a class="pager__link" href="{{ .PrevInSection.RelPermalink }}" rel="prev">
			<span class="pager__subtitle">«&thinsp;{{ T "post_nav_prev" }}</span>
			<p class="pager__title">{{ .PrevInSection.Title }}</p>
		</a>
	</div>
	{{- end }}
	{{- if .NextInSection }}
	<div class="pager __item pager__ item--next">
		<a class="pager__link" href="{{ .NextInSection.RelPermalink }}" rel="next">
			<span class="pager__subtitle">{{ T "post_nav_next" }}&thinsp;»</span>
			<p class="pager__title">{{ .NextInSection.Title }}</p>
		</a>
	</div>
	{{- end }}
</nav>
{{- end }}
{{- end }}

```

Thank you

---

<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:** [May 5, 2023, 2:59pm UTC](https://discourse.gohugo.io/t/pagination-across-sections/44218/2 "2023-05-05T14:59:55Z")

</div>

You can do something ala:

```auto
{{ $prev := site.RegularPages.Prev . }}
{{ $next := site.RegularPages.Next . }}
... and then replace .PrevInSection and .NextInSection with the above 2 vars

```

---

<div class="post-metadata">

**Author:** ![tedcm](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@tedcm](https://discourse.gohugo.io/u/tedcm)\
**Post date:** [May 5, 2023, 3:48pm UTC](https://discourse.gohugo.io/t/pagination-across-sections/44218/3 "2023-05-05T15:48:06Z")

</div>

Thank you. It worked!

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [May 7, 2023, 3:48pm UTC](https://discourse.gohugo.io/t/pagination-across-sections/44218/4 "2023-05-07T15:48:32Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
