collections.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 }}