I'm trying to setup a blog with Hugo which basically works fine as long as I use Markdown. But since I also have some other website contents (docs) with antora in the repo I want to write all my texts with asciidoc. But I always run into this error, when I try to generate the website from adoc files. Markdown works, but Asciidoc gives this exception:
sebastian@kobol:~/work/repos/sommerfeld-io/website/blog$ hugo
Start building sites …
hugo v0.92.1-85E2E862 linux/amd64 BuildDate=2022-01-27T11:44:41Z VendorInfo=gohugoio
Error: Error building site: "/home/sebastian/work/repos/sommerfeld-io/website/blog/content/posts/my-second-post.adoc:1:1": access denied: "asciidoctor" is not whitelisted in policy "security.exec.allow"; 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 = ['.*']
Total in 40 ms
Can anyone give me a hint on how I can allow access to asciidoctor from hugo builds?
That's the default Security Policy. You need to edit your config.toml
file (or wherever you put your Hugo configuration files) and add a custom security policy.
As a minimum, the custom security policy will be a "cut & paste" of the default, with one or two additional regular expressions added.
For example:
[security]
enableInlineShortcodes = false
[security.exec]
allow = ["^dart-sass-embedded$", "^go$", "^npx$", "^postcss$", "^asciidoctor$"]
osEnv = ["(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM|RUBYLIB)$"]
[security.funcs]
getenv = ["^HUGO_"]
[security.http]
methods = ["(?i)GET|POST"]
urls = [".*"]
I also added the RUBYLIB
environment variable to tell Hugo to tell AsciiDoctor where its inline macro extensions live.