getenv
少于1分钟
将以下英文翻译为中文:
getenv
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.
最后修改 June 1, 2023: 新增一个配置参数:sidebar_menu_truncate = 500 用于解决菜单不全的问题 (27810f1)