如何修复 Hugo access denied: "asciidoctor" is not whitelisted in policy "security.exec.allow"; the current security configuration is:

问题:

编译 Hugo 页面时,你会看到类似这样的错误消息

hugo_error_output.txt
ERROR render of "section" failed: "/home/uli/klc/themes/hugo-theme-techdoc/layouts/_default/list.html:3:4": execute of template failed: template: _default/list.html:3:4: executing "main" at <.Content>: error calling Content: "/home/uli/klc/content/footprint/F2/_index.adoc:1:1": access denied: "asciidoctor" is not whitelisted in policy "security.exec.allow"; the current security configuration is:

解决方案

你需要编辑 Hugo 配置文件,将 asciidoctor 或导致错误的程序添加到允许执行的程序列表中。

对于 TOML 配置文件,添加以下部分,由默认值加上 asciidoctor 组成

hugo-config.toml
[security]
    [security.exec]
    allow = ['^(dart-)?sass(-embedded)?$', '^go$', '^npx$', '^postcss$', '^asciidoctor$']

之后,重新编译你的 Hugo 页面。


Check out similar posts by category: Python