Posts Tags Categories About
Hugo主题定制

where函数的使用

<!-- slice中的对象的指定field和parameter进行指定operator, 根据返回值来过滤. -->
{{ where slice field operator parameter }}

获取分页器(Paginator)

我们使用.Paginate获取分页器, 通常后面接一些过滤后的Page切片.

{{ $paginator := .Paginate (where .Site.RegularPages "Type" "==" "posts") }}

.Paginate接一些复杂的表达式需要加上括号, 具体逻辑就可以自己定制了.

使用分页器(Paginator)

{{ range $paginator.Pages }}
{{ end }}