我停止了写博客一段时间,然后当我回到我的博客工作在一个新的机器与不同的软件包版本。
显然,我以前版本的“宁静峰”主题并不适用于刚刚安装的Hugo版本,所以我做了blogdown::install_theme("kakawait/hugo-tranquilpeak-theme",force = TRUE)来修复这个问题。
blogdown::build_site()然后返回以下错误:
Error: Error building site: "/home/simon/git/snippets/content/post/2021-10-01-quels-sont-les-monuments-les-plus-courants/index.html:14:14": failed to render shortcode "blogdown/postref": failed to process shortcode: "/home/simon/git/snippets/layouts/shortcodes/blogdown/postref.html:1:10": execute of template failed: template: shortcodes/blogdown/postref.html:1:10: executing "shortcodes/blogdown/postref.html" at <getenv "BLOGDOWN_POST_RELREF">: error calling getenv: access denied: "BLOGDOWN_POST_RELREF" 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 = ['.*']发布于 2022-09-02 14:17:00
最小版本:blogdown::serve_site()应该修复它。
短版本:在您的回购中编辑“layouts/短路代码/blogdown/postref.html”,将BLOGDOWN_POST_RELREF替换为HUGO_BLOGDOWN_POST_RELREF。
长版本:博客的变化:列出了从2021年12月开始的以下bug修复:在Hugo0.91.0中处理新的安全策略,将内部环境变量BLOGDOWN_POST_RELREF (在短代码布局/短代码/blogdown/postref.html中)重命名为HUGO_BLOGDOWN_POST_RELREF (谢谢,@Nitheshnirmal #672,@gergiu #673)。
最后,我从repo手工编辑了文件“layout/短路/blogdown/postref.html”,以替换行。
{{ if eq (getenv "BLOGDOWN_POST_RELREF") "true" }}{{ .Page.RelPermalink }}{{ else }}{{ .Page.Permalink }}{{ end }}带着线
{{ if eq (getenv "HUGO_BLOGDOWN_POST_RELREF") "true" }}{{ .Page.RelPermalink }}{{ else }}{{ .Page.Permalink }}{{ end }}https://stackoverflow.com/questions/73583953
复制相似问题