.Paginate error when working with WeightedPages (from a taxonomy)

I am working on a landing page for blogs based on category. I have the links for by category working. And it loads up the appropriate md files when I land on the template defined by /layout/taxonomy/category.html. I also have pagination working when I have the main blog page and ALL the files. However, for the category page I am pulling from the taxonomy variable and getting an error when trying to paginate. If I take the pagination out it works just fine.

I will post my code and my error message below and hopefully someone can point me in the right direction.

{{ $lastUrlElement := index (last 1 (split (delimit (split .URL "/") "," "") ",")) 0 }}
{{ $baseurl := .Site.BaseURL }}

{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
    {{ if eq "categories" $taxonomyname }}   	
  	    {{ range $key, $value := $taxonomy }}
  	    	{{ if eq $key $lastUrlElement }}
  	    		<ul class="blog-list">
  	    		{{ $pag := .Paginate (where $value.Pages "Type" "post") 2 }}
        		{{ range $pag.Pages }}
    	    		{{ partial "blog-preview.html" . }}
        		{{ end }}
        		</ul>

	    		<div class="clearfix">
				{{ if .Paginator.HasPrev }}
					<a class="prev page-nav" href="{{ $baseurl }}{{ $pag.Prev.URL }}">Prev</a>
				{{ end }}

				{{ if .Paginator.HasNext }}
					<a class="next page-nav" href="{{ $baseurl }}{{ $pag.Next.URL }}">Next</a>
				{{ end }}
				</div>
        	{{ end }}
      	{{ end }}     	
    {{ end }}  
{{ end }}`

And here is my error message.

Started building sites ...
ERROR 2017/05/11 17:43:44 Error while rendering "taxonomy": template: theme/taxonomy/category.html:11:20: executing "theme/taxonomy/category.html" at <.Paginate>: can't evaluate field Paginate in type hugolib.WeightedPages