From: mdhender Date: Sun, 5 Apr 2015 01:07:25 +0000 (-0500) Subject: Document getenv template function X-Git-Tag: v0.14~137 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=42dcaabf4f81ccd8aa831049440bb0c5d85707d6;p=brevno-suite%2Fhugo Document getenv template function Add `getenv` to the template function documentation. --- diff --git a/docs/content/templates/functions.md b/docs/content/templates/functions.md index 6dbc58bf..c380b091 100644 --- a/docs/content/templates/functions.md +++ b/docs/content/templates/functions.md @@ -76,6 +76,19 @@ e.g. {{ end }} +### getenv +Returns the value of an environment variable. + +Takes a string containing the name of the variable as input. Returns +an empty string if the variable is not set, otherwise returns the +value of the variable. Note that in Unix-like environments, the +variable must also be exported in order to be seen by `hugo`. + +e.g. + + {{ getenv "HOME" }} + + ### in Checks if an element is in an array (or slice) and returns a boolean. The elements supported are strings, integers and floats (only float64 will match as expected). In addition, it can also check if a substring exists in a string.