如何防止Blogdown重新呈现所有帖子? [英] How to prevent blogdown from rerendering all posts?

查看:86
本文介绍了如何防止Blogdown重新呈现所有帖子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

我正在使用基于@YihuiXie R包blogdown构建的博客.

I am featuring a blog built on @YihuiXie's R package blogdown.

问题:

当我render_site()时,将呈现所有源文件(* .Rmd)-甚至重新呈现未更改的源文件.

When I render_site(), all source files (*.Rmd) are rendered - even the unchanged source files are re-reendered.

这种完全重新渲染既费时又不必要(我认为).

This complete re-rendering is time consuming and unnecessary (I think).

问题/所需解决方案:

如何防止Blogdown重新呈现未更改的源文件?我希望Blogdown仅呈现新的或更改的源文件.

How can I prevent blogdown from re-rendering the unchanged source files? I want blogdown to render only new or changed source files.

我已经尝试过的方法:

  • I've read the blogdown book; Yihui seems to propose the "rebuild-all" approach.

我已经阅读了render_site()hugo_build()的帮助文件.第一个声明它将渲染所有rmd文件.相反,hugo_build()不会编织rmd文件(即rmd文件未编译为md文件).

I've read the help files for render_site() and hugo_build(). The first one states that it will render all rmd files. In contrast hugo_build() does not knit rmd files (ie., rmd files are not compiled to md files).

我已经检查了SO和Google,但以前似乎没有问过这个问题.

I've checked SO and Google, but this question seems not to have been asked before.

SessionInfo():

R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_1.1.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17    rstudioapi_0.7  knitr_1.20      magrittr_1.5    RcppTOML_0.1.3  xtable_1.8-2    R6_2.2.2        rlang_0.2.0     stringr_1.3.1   tools_3.4.4     xfun_0.1       
[12] miniUI_0.1.1.1  htmltools_0.3.6 yaml_2.1.19     rprojroot_1.3-2 digest_0.6.15   bookdown_0.7    later_0.7.2     promises_1.0.1  evaluate_0.10.1 mime_0.5        rmarkdown_1.9.4
[23] blogdown_0.6    stringi_1.2.2   compiler_3.4.4  backports_1.1.2 jsonlite_1.5    httpuv_1.4.3   
> 

推荐答案

我认为答案在您引用的页面上- 博客的第1.7节(推荐的工作流程").您似乎还不太清楚,所以让我改一下:

I think the answer is on the page you referenced -- Section 1.7 of the blogdown book ("A recommended workflow"). It seems it is not clear enough to you, so let me rephrase it:

  1. 您应该很少需要bookdown::render_site().您可以看到在1.7节中我什至没有提到此功能.

  1. You should rarely need bookdown::render_site(). You can see that I didn't even mention this function in Section 1.7.

使用blogdown::serve_site(),如果您的网站是在Netlify或任何可以运行hugo命令来构建您的服务器上发布的网站,则只需调用 函数服务器端的网站.

Use blogdown::serve_site(), and it is the only function you need to call if your website is published on Netlify, or any servers that can run the hugo command to build your website on the server side.

如果您不使用Netlify或不在服务器端调用hugo,但是要在本地构建站点并手动发布public/文件夹,请在发布网站之前调用blogdown::hugo_build()

If you do not use Netlify, or do not call hugo on the server side, but want to build the site locally and publish the public/ folder manually, call blogdown::hugo_build() before you publish your website.

由于您使用的是Netlify,因此答案基本上是blogdown::serve_site().这就是您所需要的.它不会重新呈现尚未更改的Rmd文件.参见附录D.3 .

Since you are using Netlify, the answer is basically blogdown::serve_site(). That is all you need. It does not re-render Rmd files that have not been changed. See the Appendix D.3.

这篇关于如何防止Blogdown重新呈现所有帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆