Creating a Blog
I was recently inspired by my friend to create a blog. After thinking, “I’ll get around to that when I have time” for many months I decided to just go for it.
It actually took me almost 2 whole days to fight with different platforms and figure out how hosting on Github works but it turns out it is really simple if you know where to start.
For my friend, others, (and frankly myself so I don’t forget) I want to explain “How It’s Made”
First, you’ll need to join Github. Note that, unless you want to pay for a domain name, your website URL will be
<username>.github.io so choose your username wisely.
Next, create a repository called
<username> is the user name you chose to create your account.
I decided to use Jekyll-Bootstrap because I wanted to get something up and working quickly. The website boasts “0 to Blog in 3 Minutes” and that is pretty accurate (at least if you have the dependencies installed). See their nice quick start guide.
These instructions will tell you how to clone the existing repository into a local repository and then link that with the repository you already created on Github. They also explain how to install jekyll locally, which is important so that you can preview your website content before pushing to Github (which will automagically publish it to your site).
You’ll need to have
gem installed first and you can install
rake to follow the examples in the quick start guide.
To supplement the Jekyll documentation, I followed the wise advice of others who created their blogs and subsequently blogged about it.
I especially found these posts helpful:
- Fellgernon Big Blog post entitled “Creating your Jekyll-Bootstrap powered blog for R blogging
- Jason Fisher’s Blog post for help with getting theme and syntax highlighting for code working
I spent a while trying to get syntax highlighting to work (I’m not familar with web-dev, css files, etc.). In the end, I did this:
- Added Jason Fisher’s syntax.css to
- Added the last line of the following code to
Publishing a post
Once you’re all set up, publishing a post could not be simpler!
Just create a markdown file, add it, commit, and push to Github.
.gitignore file looks like this which is pretty standard because you don’t actually want to push the
_site folder (Github handles creating this for you from the contents in the other directories)
Working with R Markdown
But to get syntax highlighting, I modified the function to call
render_jekyll instead of
This will automatically add the liquid tags necessary to tell Jekyll how to highlight code.