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

Pie*_*hon 7 markdown r r-markdown hugo blogdown

我一直按照此处的说明安装 R blogdown 软件包并运行我的新网站。当我到达运行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 = ['.*']

Run Code Online (Sandbox Code Playgroud)

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

多谢!

Yih*_*Xie 14

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

security:
  funcs:
    getenv:
      - ^HUGO_
      - ^WC_
Run Code Online (Sandbox Code Playgroud)

将环境变量列入白名单WC_POST_CSS