Blogdown, a package to create websites

Blogdown is a R package to generate static websites based on R Markdown and Hugo, a static web engine. To be honest: It’s fantastic!
I’ve been using Wordpress for a while, with all that hassle of copy-pasting html into the wp text editor, adjusting images… Not to mention all the fuzz that goes along when using htmlwidgets. That blog-agony is all over with blogdown.

My take-ways

Must read: Blogdown online book: definitely read the first 3 chapters and the appendix! I’m using the same theme as Rstudio Rviews blog, which is the icarus theme.
However, for my blog I made following adjustments:

  • removed the banner placeholder
  • removed the thumbnail placeholder of the recent post in the right sidebar
  • replaced the monokai.css with default github.css for code highlight
  • adjust correct padding of post archive

Adding disqus (comment section below each post) can be annoying, but this process should overcome minor issues:

  • add your site to disqus to retrieve the disqusShortname
  • add your disqusShortname in the config.toml file
  • run `blogdown::build_site()
  • copy everything under the public dir to your web dir on your webserver
  • test, test, … afaik.

Add an image in the yaml metadata of a post. This image will be used in the social-media card when sharing posts with twitter, facebook, linkedin, etc. When generating your html file of the post, it wil start looking for the image from the /static folder, so add a path from this point to your image.

Most important take-way

There is a big difference between blogdown::serve_site(), blogdown::hugo_build() and blogdown::build_site():

  • blogdown::serve_site() is for local use only. It will generate html files of your new/adjusted (r)markdown posts.
  • blogdown::hugo_build() builds the public skeleton, but will not generate new html post compared to blogdown::serve_site()
  • blogdown::build_site() builds the whole website for publishing, thus will render all *.Rmd files again.
    • Make sure you set the baseurl= in the config.toml file correct before using blogdown::build_site() or blogdown::hugo_build(). The baseurl is needed to activate the disqus and the social widgets.

My publish flow exists of step 1 and 2. And step 3 is optional and only in case when I need to render everything again.

Most likely, I forgot a thing or two. So if you would like to use this theme go fetch it at github.

Share Comments
comments powered by Disqus