I Need Help with Pagination

Hello, I was using {{ range (.Paginator 24).Pages }} to show exactly 24 tags on my tags index and it was working perfectly but after I found that there is a problem with canonicals tags on google search console I used this:

{{- if .Paginator }}
  {{- if .Paginator.HasPrev }}
    <link rel="prev" href="{{ .Paginator.Prev.URL | absURL }}" />
  {{- end }}
  {{- if .Paginator.HasNext }}
    <link rel="next" href="{{ .Paginator.Next.URL | absURL }}" /> 
  {{- end }}
  <link rel="canonical" href="{{ .Paginator.URL | absURL }}" /> 
{{- else }}
  <link rel="canonical" href="{{ .Permalink }}" />
{{- end }} 

on my baseof to fix it, but it seems that this broke the pagination on my tags index,

Please use fenced code blocks when posting code to this forum. I edited your post to make it legible.

You need to paginate before referencing the .Paginator properties.

This describes the problem in a little more detail:

This describes a strategy (with example) for doing what you want to do: