【发布时间】:2021-03-29 16:04:53
【问题描述】:
今天我想为我的网站创建一个新帖子(使用 blogdown 构建),但新帖子插件似乎不起作用。 当我选择“新帖子”或运行时
blogdown:::new_post_addin()
我收到一个错误:
Error in FUN(X[[i]], ...) : subscript out of bounds
In addition: Warning messages:
1: In value[[3L]](cond) :
Cannot parse the YAML metadata in 'content/photo.md': Scanner error: while scanning an alias at line 3, column 1 did not find expected alphabetic or numeric character at line 3, column 2
2: In value[[3L]](cond) :
Cannot parse the YAML metadata in 'content/research.md': Scanner error: while scanning an alias at line 4, column 1 did not find expected alphabetic or numeric character at line 4, column 2
我不确定附加警告是关于什么的,但我想关注主要错误。以下是 traceback() 返回的详细信息:
> traceback()
10: lapply(meta, `[[`, i)
9: unlist(lapply(meta, `[[`, i))
8: blogdown:::collect_yaml()
7: eval(exprs[i], envir)
6: eval(exprs[i], envir)
5: sys.source(pkg_file("scripts", file), envir = new.env(parent = globalenv()),
keep.source = FALSE)
4: xfun::in_dir(site_root(), expr)
3: in_root(sys.source(pkg_file("scripts", file), envir = new.env(parent = globalenv()),
keep.source = FALSE))
2: source_addin("new_post.R")
1: blogdown:::new_post_addin()
有趣的是,当我运行这个命令时:
blogdown::new_post(title, ext = '.md')
它工作正常,我可以创建一个新帖子。我更新了 blogdown 和 hugo 但无济于事。有人可以帮我理解这个错误是什么吗?其他插件(如插入图片)工作正常。
根据要求,Githup 存储库为 https://github.com/msmielak/msmielak.github.io,dput() 输出如下:
>dput(blogdown:::scan_yaml())
list(`content/about.md` = "<img align=\"right\" src=\"/./about_files/rsz_screenshot_2020-12-28_une_home.png\" alt=\"\" width=\"100px\"/>\n\n**2014-**\nPhD candidate at the School of Environmental and Rural Sciences University of New England in Armidale, Australia.",
`content/code.md` = NULL, `content/contact.md` = NULL, `content/photo.md` = NULL,
`content/post/2021-03-29-extracting-date-and-time-from-photo-using-ocr-engine-tesseract/index.md` = list(
title = "Extracting date and time from camera trap photos using R and tesseract",
author = "", date = "2021-03-29", slug = list(), categories = c("code",
"R"), tags = c("R", "code", "camera trap", "OCR"), description = "",
featured = "", featuredalt = "", featuredpath = "", linktitle = ""),
`content/research.md` = NULL, `content/technology.md` = NULL)
Warning messages:
1: In value[[3L]](cond) :
Cannot parse the YAML metadata in 'content/code.md': Parser error: did not find expected <document start> at line 3, column 67
2: In value[[3L]](cond) :
Cannot parse the YAML metadata in 'content/photo.md': Scanner error: while scanning an alias at line 3, column 1 did not find expected alphabetic or numeric character at line 3, column 2
3: In value[[3L]](cond) :
Cannot parse the YAML metadata in 'content/research.md': Scanner error: while scanning an alias at line 4, column 1 did not find expected alphabetic or numeric character at line 4, column 2
【问题讨论】:
-
您能在帖子中提供
dput(blogdown:::scan_yaml())的输出吗?或者提供一个可重现的示例,例如 Github 存储库。谢谢!
标签: r-markdown hugo blogdown