From 42dcaabf4f81ccd8aa831049440bb0c5d85707d6 Mon Sep 17 00:00:00 2001 From: mdhender Date: Sat, 4 Apr 2015 20:07:25 -0500 Subject: [PATCH] Document getenv template function Add `getenv` to the template function documentation. --- docs/content/templates/functions.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/content/templates/functions.md b/docs/content/templates/functions.md index 6dbc58bf7..c380b091b 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.