mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 20:52:08 -05:00
788 B
788 B
title | description | date | publishdate | lastmod | categories | menu | keywords | signature | workson | hugoversion | relatedfuncs | deprecated | aliases | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getenv | Returns the value of an environment variable, or an empty string if the environment variable is not set. | 2017-02-01 | 2017-02-01 | 2021-11-26 |
|
|
|
false |
Examples:
{{ os.Getenv "HOME" }} --> /home/victor
{{ os.Getenv "USER" }} --> victor
You can pass values when building your site:
MY_VAR1=foo MY_VAR2=bar hugo
OR
export MY_VAR1=foo
export MY_VAR2=bar
hugo
And then retrieve the values within a template:
{{ os.Getenv "MY_VAR1" }} --> foo
{{ os.Getenv "MY_VAR2" }} --> bar