1--- 2title: append 3description: "`append` appends one or more values to a slice and returns the resulting slice." 4date: 2018-09-14 5categories: [functions] 6menu: 7 docs: 8 parent: "functions" 9keywords: [collections] 10signature: ["COLLECTION | append VALUE [VALUE]...", "COLLECTION | append COLLECTION"] 11workson: [] 12hugoversion: "0.49" 13relatedfuncs: [last,first,where,slice] 14aliases: [] 15--- 16 17An example appending single values: 18 19```go-html-template 20{{ $s := slice "a" "b" "c" }} 21{{ $s = $s | append "d" "e" }} 22{{/* $s now contains a []string with elements "a", "b", "c", "d", and "e" */}} 23 24``` 25 26The same example appending a slice to a slice: 27 28 29```go-html-template 30{{ $s := slice "a" "b" "c" }} 31{{ $s = $s | append (slice "d" "e") }} 32``` 33 34The `append` function works for all types, including `Pages`. 35 36 37 38 39