shithub: hugo

Download patch

ref: 42dcaabf4f81ccd8aa831049440bb0c5d85707d6
parent: 9a499b56c964d08fe43a43e48fe038f489cebfb6
author: mdhender <[email protected]>
date: Sat Apr 4 16:07:25 EDT 2015

Document getenv template function

Add `getenv` to the template function documentation.

--- a/docs/content/templates/functions.md
+++ b/docs/content/templates/functions.md
@@ -76,6 +76,19 @@
     {{ 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.