mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Merge commit '7c62d6ef1654c0383eae474d3bd9ddf7754c1f30'
This commit is contained in:
@@ -12,8 +12,8 @@ relatedfuncs: []
|
||||
Examples:
|
||||
|
||||
```go-html-template
|
||||
{{ os.Getenv "HOME" }} --> /home/victor
|
||||
{{ os.Getenv "USER" }} --> victor
|
||||
{{ os.Getenv "HOME" }} → /home/victor
|
||||
{{ os.Getenv "USER" }} → victor
|
||||
```
|
||||
|
||||
You can pass values when building your site:
|
||||
@@ -31,8 +31,8 @@ hugo
|
||||
And then retrieve the values within a template:
|
||||
|
||||
```go-html-template
|
||||
{{ os.Getenv "MY_VAR1" }} --> foo
|
||||
{{ os.Getenv "MY_VAR2" }} --> bar
|
||||
{{ os.Getenv "MY_VAR1" }} → foo
|
||||
{{ os.Getenv "MY_VAR2" }} → bar
|
||||
```
|
||||
|
||||
With Hugo v0.91.0 and later, you must explicitly allow access to environment variables. For details, review [Hugo's Security Policy](/about/security-model/#security-policy). By default, environment variables beginning with `HUGO_` are allowed when using the `os.Getenv` function.
|
||||
|
Reference in New Issue
Block a user