hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

append.md (797B)

    1 ---
    2 title: append
    3 description: "`append` appends one or more values to a slice and returns the resulting slice."
    4 date: 2018-09-14
    5 categories: [functions]
    6 menu:
    7   docs:
    8     parent: "functions"
    9 keywords: [collections]
   10 signature: ["COLLECTION | append VALUE [VALUE]...", "COLLECTION | append COLLECTION"]
   11 workson: []
   12 hugoversion: "0.49"
   13 relatedfuncs: [last,first,where,slice]
   14 aliases: []
   15 ---
   16 
   17 An 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 
   26 The same example appending a slice to a slice:
   27 
   28 ```go-html-template
   29 {{ $s := slice "a" "b" "c" }}
   30 {{ $s = $s | append (slice "d" "e") }}
   31 ```
   32 
   33 The `append` function works for all types, including `Pages`.