As I was mentioning the inaugural blog post, I was looking to build a simple but elegant solution to manage my blog, and as I went for the static site generator route, I was left with no “administration” panel to write and publish posts.
While researching my options, I noticed a lot of people were using GitHub to host their sources, and deploying either to GitHub pages or to other hosts via Git hooks. But I wanted to use the infrastructure I already had in place using Visual Studio Team Services to host the code and Azure Websites for hosting.
First of all, I had to understand how Hexo works (and pretty much any static site generator for that matter). This wasn’t very hard, you just need to read the readme file of the tool. I’ll lay it out in a few words. First you need to install the tool, usually using npm. Once you have it, you can initialize your blog in a new folder - I’m not going to go into any more details about this, maybe another post. Suffice to say, this folder is now your “source” for the blog. Since the tool has quite a few dependencies, you need to run npm install to ensure they all get deployed in your folder as well. Once you have that, you run a command to generate your site - same as you would compile your sources in any other language. The result of this compilation is a folder that is essentially your entire site - a self-contained website consisting of just a bunch of HTML, CSS, JS and images. The idea is, you take this folders and publish it anywhere and you’re done with it.
So my goal for the blog deployment was to be able to host my code in Visual Studio Team Sarvices in a Git repository and every time I write something, commit the article and via some magic in the next couple of minutes my Azure Website would show the post. I could commit a new markdown file in the repository from anywhere or any device and it I would get a new post on my blog. No need to worry about compilation, deployment, or anything