blogdown::serve_site() 无法生成模板网站

blogdown::serve_site() fails to produce template site

我一直在按照说明 here 安装 R blogdown 软件包并获取我的新站点 运行ning。当我到达 运行 serve_site() 的步骤时,我收到以下错误消息:


Launching the server via the command:
  C:/Users/xxxxx/AppData/Roaming/Hugo/0.91.0/hugo.exe server --bind 127.0.0.1 -p 4321 --themesDir themes -t starter-hugo-academic -D -F --navigateToChanged
Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: book/single.html:5:3: executing "book/single.html" at <partial "site_head" .>: error calling partial: "C:\Users\em14031\OneDrive - AUT University\Personal_website\themes\github.com\wowchemy\wowchemy-hugo-modules\wowchemy\v5\layouts\partials\site_head.html:208:13": execute of template failed: template: partials/site_head.html:208:13: executing "partials/site_head.html" at <getenv "WC_POST_CSS">: error calling getenv: access denied: "WC_POST_CSS" is not whitelisted in policy "security.funcs.getenv"; the current security configuration is:

[security]
  enableInlineShortcodes = false
  [security.exec]
    allow = ['^dart-sass-embedded$', '^go$', '^npx$', '^postcss$']
    osEnv = ['(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM)$']

  [security.funcs]
    getenv = ['^HUGO_']

  [security.http]
    methods = ['(?i)GET|POST']
    urls = ['.*']

所以看起来有一些安全配置文件需要编辑,但是我在项目中的“~/config/_default”中找不到它。知道这个文件在哪里吗?

非常感谢!

配置文件在您的网站项目中 config/_default/config.yaml。添加

security:
  funcs:
    getenv:
      - ^HUGO_
      - ^WC_

将环境变量列入白名单WC_POST_CSS