【问题标题】:unmarshal failed: Near line 0 (last key parsed ''): bare keys cannot contain ':' in Rmarkdown blogdown with Hugounmarshal failed: Near line 0 (last key parsed ''): bare keys cannot contain ':' in Rmarkdown blogdown with Hugo
【发布时间】:2021-01-24 23:01:51
【问题描述】:

在 Rmarkdown 中运行 build_site() 时出现此构建错误,我最初忽略了该错误,因为否则它似乎很好。但是现在尝试从 netlify 进行部署后,错误不允许构建和部署站点。

我得到了错误

unmarshal failed: Near line 0 (last key parsed ''): bare keys cannot contain ':'

它说错误在我的config.toml:1:1 文件中,但文件显示为config.toml,但我没有手动更改此文件,除非 blogdown 过度写入?我在很多博客中都没有遇到过这个错误。

我的 config.toml 文件在下面

name: "blog"
title: "blog name"
description: |
  blog name
output_dir: "_site"
navbar:
  right:
    - text: "Home"
      href: index.html
output: distill::distill_article

任何帮助将不胜感激,如果需要,我可以显示更多细节。谢谢,

【问题讨论】:

  • 这似乎是 YAML 文件,而不是 TOML 文件。您是否真的将此文件命名为“config.toml”,或者这是问题中的错误?
  • 你是对的,我有错误的文件,我现在已经更新并继续我的故障排除,谢谢
  • 我得到“找不到网站的配置文件 config.toml | config.yaml”,但两个文件都在父目录中。我可以编织整个网站并且渲染得很好,但是当我运行 serve_site() 和 build_site() 时,我得到了这些错误
  • 其实看了文档后,.toml 文件使用key = value 对语法,我的冒号: 是错误的,但我不知道是怎么变成这样的

标签: r r-markdown hugo blogdown toml


【解决方案1】:

看来由于这是一个distill博客,所以没有使用.toml/.yaml文件,我使用的功能是针对blogdown站点的,因为这是一个DISTILL博客,所以我需要使用functinorender_site()从 rmarkdown 包中,这会将 .Rmd 文件呈现为 HTML 并将它们推送到 _sites 目录以进行发布。

【讨论】:

    【解决方案2】:

    在最新版本的 Hugo 中,默认会自动搜索根目录下的数据 config.toml 文件,你使用的主题必须是 config.yaml 配置文件。把原来的 config.toml 删掉就行了。注意:在. toml 中,':' self 字符是不允许的。它应该是 '='。

    【讨论】:

    • .yaml 让我很困惑,因为这两个文件都在根目录中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-01
    • 2017-11-12
    • 2020-10-22
    • 2021-09-25
    • 1970-01-01
    • 2014-11-30
    • 1970-01-01
    相关资源
    最近更新 更多