Skip to main content

jbrnbrg

Updating this Site with blogdown

The shutdown related to the global pandemic has freed up some time for me and that seemed like a good enough reason to update the look of my website. In today’s post, I will share my experience with blogdown as well as the resources I used to make the update.

Background

Up until now, I had been using the PyCharm IDE along with Jekyll to create posts from .markdown files but since I do a lot of work in RStudio, I figured that switching to blogdown would simplify things; it converts .Rmd files to .html pages that can be posted directly to the site’s repo.

Resources

Even if you have no experience with making websites, html, css, or js, the blogdown online text is a comprehensive resource for making a website using the package. It covers building, formatting, and deploying your site or blog using RStudio and it allows one to get up-and-running quickly.

Formatting

The blogdown package offers the blogdown::new_site() function to select any Hugo theme for your template site - take your time selecting! - there are 100’s of options with different looks, features, functionality, and complexity. Make a list of requirements and ensure the theme you select meets those requirements fully before you begin - it’ll help reduce duplicative work down the road.

Another tip: The more popular the theme, the more resources you will have if you want to make customization. I may consider switching to the academic theme one day - there are so many folks using it that there are tons of resources for customization that aren’t mentioned in the text like code-folding.

One requirement I had was to use highlight.js for code highlighting so I selected a theme that allowed me to implement that feature easily. Check out their demo site to see what options are available for code block formatting.

Migration

Having some experience with a static site generator will be helpful here. It took me a couple of hours of work reformatting YAML from old posts to be able to make the switch and start customizing.

My new site has more features, looks better (IMO), and is easier to maintain than the old site but it’s not all upside. If you’re hosted on GitHubPages like me, blogdown/Hugo doesn’t have code folding and getting it to work is non-trivial unless you’re using the academic theme.

Getting an interactive plot embedded in a post is as easy as knitting a .Rmd file - making interactive plots work with just Jekyll is much messier.

Overall, I have been very happy with the new workflow and look but if I ever decide to change again, I’ve got all the .Rmd files ready to go. Highly recommended - why not update your site with it?