Syntax question: .Paginate (where ...).Pages gives an error

When I try to use

range .Paginate (where .Site.Pages "Type" "blog").Pages <!-- error -->

Hugo throws the error can't evaluate field Pages in type page.Pages. Splitting it up

$paginator := .Paginate (where .Site.Pages "Type" "blog") <!-- works -->
range .paginator.Pages

works fine. I was under the impression that one can dot chain fields to a function result like so $file := (path.Split .).File (which in fact works ok). But that seems not to be always the case. Is there an explanation available as to when one can directly access the (fields of a ) return values of a function that way and when not?

Should be

range (.Paginate (where .Site.Pages "Type" "blog")).Pages

Because you want to range over the .Pages, which are the property of the .Paginate results. In your example, you are getting the .Pages from the results of where


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