collections.Last
语法
collections.Last N COLLECTION
返回
any
别名
last
{{ range last 10 .Pages }}
{{ .Render "summary" }}
{{ end }}
将 N
设置为零以返回空集合。
{{ $emptyPageCollection := last 0 .Pages}}
将 last
和 [where
] 一起使用。
{{ range where .Pages "Section" "articles" | last 5 }}
{{ .Render "summary" }}
{{ end }}