Blogging With Medium and Github Pages

What a cutie

Background

Enter Github Pages. This allows me to quickly set up a personal blog site I can link to. It also allows me to write in Markdown, which I find much simpler than Medium’s formatter, and I can save my blogs with git. I can then use Markdown to Medium to export my blog to Medium.

Setting up Github Pages

For initial Github Pages setup, you can follow the basic introduction. Make sure your repository name is [your-username].github.io. The url for your page will end up being the same. If you have followed the directions, you will have a bare-bones site with "Hello World" in an index.html. Rather than dealing with HTML, let's set up Jekyll.

Setting up Jekyll

Here is where it gets just a bit hairy. The link to Jekyll with Github Pages is here, but the documentation is not ideal. Rather than repeat the steps that are in the help center, I will give a high-level overview, then mention where I struggled.

The first few steps involve setting up a git repository, and what branch/directory you should be in. If you are reading my humble blog, you are probably making a personal site. I would just recommend being on the master branch, and I would not bother to designate a publishing source directory.

The docs then go on to use bundle exec jekyll VERSION new ., which didn't quite work for me. I adapted this Stackoverflow post. I did not use Jekyll 4.0.0, as that was not in the recommended versions for github. Instead, I made sure that the version in the Gemfile matched the recommended, and simply called bundle exec jekyll .. It offered to rewrite everything in the directory (which was fine by me). It then generated the Jekyll site, and retained my git repository.

Testing Locally

Creating Posts

Personalization

I used Jekyll because it is easy to set up, and gives you some out-of-the-box styling. You can mess with this further, but it can get very complex very quickly. I won’t attempt to go over the details, just some initial problems you could run into. You can change the theme of the site in the _config. Github Pages comes with some built-in themes, and the default is minima. You can change to another theme by looking at the directions on their own repository, but there are caveats.

The problem with other themes is their layouts. Layouts go in the _layouts directory, and set up the look of your site. The minima theme includes default, home, page, and post layouts, so you already have the formatting for a blog. Remember that you need metadata at the top of your markdown files, and that includes the layout. Since minima already has these themes, you don't need to deal with them. However, for the other built-in themes, they usually only have a default theme. You can try creating your own _layouts directory and copying the ones from minima, but that does not always look great. If you want to work with another theme, you will have to do quite a bit of modification and planning.

Files

In Conclusion

Originally published at http://elliott-king.github.io.

--

--

NYC, fullstack

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store