append
Syntax
COLLECTION | append VALUE [VALUE]...
COLLECTION | append COLLECTION
An example appending single values:
{{ $s := slice "a" "b" "c" }}
{{ $s = $s | append "d" "e" }}
{{/* $s now contains a []string with elements "a", "b", "c", "d", and "e" */}}
The same example appending a slice to a slice:
{{ $s := slice "a" "b" "c" }}
{{ $s = $s | append (slice "d" "e") }}
The append
function works for all types, including Pages
.