Distill for R Markdown

[This article was first published on shikokuchuo{net}, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

                                                            sha256
1 db79682f8bee39d7ed9231200fd076ebed92a4471a9f3ce611d0a5a28bb984a3

Created using Distill

This website was created using Distill for R Markdown, a web publishing format optimised for scientific and technical communication.

Key advantages

  • R markdown to run R code (and all the possibility that brings)
  • Use markdown / html interchangeably
  • No dependency on Hugo or Jekyll, so no lock-in or need to maintain those stacks
  • Out-of-the-box support for mobile
  • Clean and attractive defaults
  • Mainly “just works”

Installation

Install release version of Distill from CRAN:

install.packages("distill")

Distill blog hosted on Github Pages step-by-step instructions

  1. Create a new blog at /blog of your current working directory in R:
distill::create_blog(dir = "blog", title = "My New Blog", gh_pages = TRUE)
  1. Make some inital changes to _site.yml. Select the ‘build’ tab in RStudio and hit ‘Build Website’. This will generate the website.

    Note: building the website does not generate blog posts. Each time the website is re-built, only the .Rmd files in the base directory will be automatically re-generated.

  2. Modify the yaml front matter and content of the example blog post. Then hit ‘Knit’ in RStudio to generate the post.

    Note: after every change made to posts or after creating a new post, you must knit each post separately. The listings page is then automatically updated.

  3. Create README.md and CNAME in /blog for your Github repository.

  4. Create a new repository at Github.

  5. To set up git and add your new repository as a remote, bring up the command line, cd to your /blog directory and:

git init
git add .
git commit -m "initial commit"
git branch -M main
git remote add origin [email protected]:username/nameofnew.git
git push -u origin main
  1. At Github, under your new repository, go to Settings >> Pages, set your source branch to ‘main’, and folder to ‘docs’.
    Optionally tick ‘Enforce HTTPS’.
    Your custom domain name should be configured automatically if you have previously set up your DNS settings to point to Github’s servers.

Congratulations, your new website should now be online!

References

The Distill Reference: https://rstudio.github.io/distill/

The Definitive R Markdown Guide: https://bookdown.org/yihui/rmarkdown/

To leave a comment for the author, please follow the link and comment on their blog: shikokuchuo{net}.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)