基本目录中的 index.Rmd 文件是做什么用的?

What is the index.Rmd file in the base directory intended for?

我相信文件 index.Rmd 在构建过程开始时被调用,所以我在那里添加了几个包安装检查。不幸的是,index.Rmd 中的代码块根本不会执行。

令我惊讶的是,即使我删除index.Rmd,该站点仍能正常构建。

blogdown网站根目录下的文件index.Rmd不会被编译。 RStudio IDE 仅读取 YAML 元数据中的 site 字段(如果存在)以获取站点生成器。参见 https://bookdown.org/yihui/bookdown/rstudio-ide.html(本节是关于 bookdown,但 blogdown 的思路相同)。

如果您不需要使用 RStudio 中的 Build 按钮(通常不需要),删除 index.Rmd 是完全安全的。