First Post!
Posted on January 3, 2015This is the first post for my R + knitr + jekyll + poole powered blog.
Expect to see some more substantial content in the future!
How It Works
I, like most other programmers, am incredibly lazy, and needed a way to author a blog that was:
- Stupidly easy to write for, and
- Stupidly easy to deploy.
Iām using a combination of jekyll, which is used to
generate the site itself; poole with the theme
Lanyon to get a jump start with Jekyll (alongside
some very nice, responsive CSS), and a simple make.R
script that converts
.Rmd
posts into .md
that can be served on GitHub pages, which is driven
mainly through the knitr package.
The R
script that powers this website is fairly simple ā we call
knitr::knit()
, with some knitr hooks + templating set up to support the
Jekyll-style markdown output. Check it out here!
Finally, I have a simple Makefile
simply calls
R --vanilla --slave -f make.R
to make the site. So, when I want to
write a new article, I can just:
- Create a file
<date>-<title>
inpost/
, - Write something that may or may not be incredibly exciting to read,
- Call
make
to update the site.
In fact, for 1., because (as I said before) I am a very lazy programmer,
so I also have a local .Rprofile
for this project that gives me some
simple functions. In particular, I have a function create_post()
for
creating a new post with some title, and the current date automatically
pre-pended to the post name.
Then GitHub Pages takes care of calling Jekyll to produce the actual site to be served. Neat!
The icing on the cake ā by giving the project an (empty) DESCRIPTION
file,
and telling RStudio that this is a
Makefile
-managed project, I can also
rebuild the site right from RStudio with Cmd + Shift + B
.