我试图建立一个与雨果博客,这基本上是好的,只要我使用Markdown。但由于我也有一些其他网站的内容(文档)与antora在回购,我想写我所有的文字与asciidoc。但是当我试图从adoc文件生成网站时,我总是会遇到这个错误。减价有效,但Asciidoc给出了这个例外:
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有人能给我一个提示,说明我如何允许从hugo中访问asciidoctor吗?
发布于 2022-02-10 09:55:50
这是默认的安全策略。您需要编辑您的config.toml文件(或放置您的Hugo配置文件的地方),并添加自定义的安全策略。
作为最低限度,自定义安全策略将是默认值的“剪切粘贴”,并添加一个或两个额外的正则表达式。
例如:
[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 = [".*"]我还添加了RUBYLIB环境变量来告诉Hugo告诉AsciiDoctor它的内联宏扩展在哪里。
https://stackoverflow.com/questions/71058236
复制相似问题