# \[SOLVED\]Create pagination pages in meta canonical

**URL:** <https://discourse.gohugo.io/t/solved-create-pagination-pages-in-meta-canonical/8430>\
**Category:** support\
**Tags:** pagination\
**Created:** [September 20, 2017, 1:46am UTC](https://discourse.gohugo.io/t/solved-create-pagination-pages-in-meta-canonical/8430 "2017-09-20T01:46:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sondang](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@sondang](https://discourse.gohugo.io/u/sondang)\
**Post date:** [September 20, 2017, 1:46am UTC](https://discourse.gohugo.io/t/solved-create-pagination-pages-in-meta-canonical/8430/1 "2017-09-20T01:46:08Z")

</div>

I use hugo 0.27.1 in arch

how can i use pagination pages like `<link rel = "canonical" href = "https://example.com/page/2/" />`

if I use `{{ .Permalink }}` just show `<link rel = "canonical" href = "https://example.com/" />` on the next page

sorry i use google translate.

thanks.

---

<div class="post-metadata">

**Author:** ![sondang](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@sondang](https://discourse.gohugo.io/u/sondang)\
**Post date:** [October 14, 2017, 11:19pm UTC](https://discourse.gohugo.io/t/solved-create-pagination-pages-in-meta-canonical/8430/2 "2017-10-14T23:19:17Z")

</div>

[SOLVED]

```
{{ $pag := .Paginate .Data.Pages }}
{{ if $pag.HasPrev }}
     <link rel="canonical" href="{{ .Paginator.URL | absURL}}" />
{{ else }}
     <link rel="canonical" href="{{ .Permalink }}" />
{{end}}
```

---

<div class="post-metadata">

**Author:** ![Rick](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rick/32/2469_2.png) [@Rick](https://discourse.gohugo.io/u/Rick)\
**Post date:** [December 8, 2017, 6:37am UTC](https://discourse.gohugo.io/t/solved-create-pagination-pages-in-meta-canonical/8430/3 "2017-12-08T06:37:09Z")

</div>

And, let’s say you are using this on a blog section and perhaps have a featured post at the top of the first page (i.e. not a paginated page). You could then add ‘not’:

```
{{ $pag := .Paginate .Data.Pages }}
{{ if not $pag.HasPrev }}
   <h1>My very special featured post</h1>
{{ else }}
   // Nothing, or something else here for our paginated pages
{{ end }}
```
