RobertMc RobertMc - 3 years ago 135
R Question

clarity on publishing drafts with Blogdown

Could anyone clarify this for me? If I use

, blogdown will compile all the
files I have in the website directory, something I don't want (and I've asked about it here).

This being the case, Yihui has recommended using
(here and here in the recommended workflow). However,
publishes draft posts, which I obviously don't want published yet.

Judging from here, it seems that something that works is
followed by
. Is that the correct way to go about it, or am I missing something? Because when I do that, the draft posts don't disappear. Thanks for any suggestions.

Edit: I should mention that running
by itself doesn't seem to publish any of the

Answer Source

Per documentation on blogdown::build_site() and serve_site():

  • build_site() and hugo_build() do not build draft or future posts;

  • serve_site() does.

Let me illustrate the differences with a table:

                build draft?    build Rmd?      build which Rmd?
build_site()      NO              YES             ALL
serve_site()      YES             YES             SINGLE (*)
hugo_build()      NO              NO              NONE

(*) Only build the modified Rmd.

If the combination you want is (1) do not build draft, and (2) build only the modified Rmd, there is not a single function to do this, but you can take two steps:

blogdown::build_site(local = TRUE, run_hugo = FALSE)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download