blogdown::serve_site() fails to produce template site
Asked Answered
D

1

7

I've been following the instructions here to install the R blogdown package and get my new site running. When I get to the step where I run serve_site(), I get the following error message:


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 = ['.*']

So it looks like there's some security config file that needs editing, however I can't find it in '~/config/_default' within the project. Any ideas where this file could be?

Thanks a lot!

Daughterinlaw answered 21/12, 2021 at 0:6 Comment(0)
A
14

The config file is config/_default/config.yaml in your website project. Add

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

to it to whitelist the environment variable WC_POST_CSS.

Alasteir answered 21/12, 2021 at 4:29 Comment(1)
Thanks, this worked for me. I could have figured it out because the security field was not already present on my config.yaml.Aleris

© 2022 - 2024 — McMap. All rights reserved.