少于1分钟
将以下英文翻译为中文:
https://gohugo.io/functions/getenv/
Returns the value of an environment variable, or an empty string if the environment variable is not set.
os.Getenv VARIABLE
getenv VARIABLE
Examples:
|
|
You can pass values when building your site:
|
|
And then retrieve the values within a template:
|
|
With Hugo v0.91.0 and later, you must explicitly allow access to environment variables. For details, review Hugo’s Security Policy. By default, environment variables beginning with HUGO_
are allowed when using the os.Getenv
function.