---
title: HasPrev
description: Reports whether there is a pager before the current pager.
categories: []
keywords: []
action:
related:
- methods/pager/HasNext
- methods/pager/Prev
- methods/pager/Next
- methods/pager/First
- methods/pager/Last
- methods/page/Paginate
returnType: bool
signatures: [PAGER.HasPrev]
---
Use the `HasPrev` method to build navigation between pagers.
```go-html-template
{{ $pages := where site.RegularPages "Type" "posts" }}
{{ $paginator := .Paginate $pages }}
{{ range $paginator.Pages }}
{{ end }}
{{ with $paginator }}
{{ with .First }}
- First
{{ end }}
{{ if .HasPrev }}
- Previous
{{ end }}
{{ if .HasNext }}
- Next
{{ end }}
{{ with .Last }}
- Last
{{ end }}
{{ end }}
```
You can also write the above without using the `HasPrev` method:
```go-html-template
{{ $pages := where site.RegularPages "Type" "posts" }}
{{ $paginator := .Paginate $pages }}
{{ range $paginator.Pages }}
{{ end }}
{{ with $paginator }}
{{ with .First }}
- First
{{ end }}
{{ with .Prev }}
- Previous
{{ end }}
{{ with .Next }}
- Next
{{ end }}
{{ with .Last }}
- Last
{{ end }}
{{ end }}
```