A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.
The following shows after
being used in conjunction with
the slice
function:
{{ $data := slice "one" "two" "three" "four" }}
{{ range after 2 $data }}
{{ . }}
{{ end }}
→ ["three", "four"]
after
with first
: 2nd–4th Most Recent
ArticlesYou can use after
in combination with the first
function and Hugo's powerful sorting methods.
Let's assume you have a list page at example.com/articles
.
You have 10 articles, but you want your templating for the list/section page to show only
two rows:
publishdate
in the content
files' front matter).{{< code file="layouts/section/articles.html" >}} {{ define "main" }}
{{ .Description }}
{{ end }}{{ .Description }}