Like many R Bloggers, I like to use Blogdown to publish blog posts. But as Paul Teetor and I got near completion of R Cookbook 2nd Edition, I began to give some thought to where I would host the online version of the book. O’Reilly has worked with Paul and me to arrange to Creative Commons license the source and content related to our book, in the same way Hadley Wickham and Garrett Grolemund did with R for Data Science and Winston Chang did with R Graphics Cookbook. On a lark I tried setting up Netlify to publish our book using the bookdown::gitbook content and it was disturbingly easy to get going. Let me show you how…
First I log into my Netlify account and click on “New Site from Git”:
And since I’m using Github, I click on the Github link:
I had already set up my Netlify account to work with my Github account for use with this blog. But I gave it access only to the one repo used for this blog. So I had to click on “configure the netlify app on GitHub” to allow Netlify to have access to my repo I’m using for our book:
I had already checked all my book content (including both the source and the HTML used for the book) into the GitHub repo. So I just had to point Netlify to the
_book folder because that’s where Bookdown sticks the HTML.
And because Bookdown is polite enough to create a book site using an
index.html and all, Netlify just copies over the
_book directory to their servers and boom web site is up and running.
And because Netlify is built on a GitHub hooks model (continuous integration), every time I check a new version of the HTML into GitHub, Netlify gets a notice from Github and then Netlify automagically updates the web content. Nothing required from me other than checking the book HTML into GitHub. This is the future I wanted, but not the future I deserve.comments powered by Disqus