This page is part of a series on my blog engine called BlogMatrix. The full series is listed below. Enjoy.
My number one priority when creating my own blog engine was that I wanted to host it for free whilst having my own custom domain name. This immediately limited the hosting providers I could use and likewise reduced the programming languages I could develop in.
All your big cloud hosting providers like Windows Azure, Amazon Web Services and Heroku were immediately scrapped as they charge for a custom domain name. This also meant that programming languages such as ASP.NET MVC, Ruby on Rails or Node were not an option.
It was for these reasons that I decided I would need my blog to generate pure HTML like Jekyll. Then worse case scenario I'd just find the cheapest hosting provider. That was when I remembered something about GitHub Pages and came across one of their help articles on setting up custom domain names. Free HTML hosting solved!
Next I had to consider how I'd convert my blog from being a local dynamic website into pure HTML files so I could host with GitHub Pages. I turned to my trusty friend google and started investigating how to generate razor pages is HTML.
An article that most caught my eye was by Phil Haack titled Text templating using Razor the easy way. I read through the article and some of the other links mentioned and was quite excited. There were a couple of negatives though:
It was at this stage that I sat back, reassessed what I was trying to achieve and had a light bulb moment! All I needed to do was spider my local development website!
Of course in true unix fashion there is already such a tool that will spider a website: wget
. So after reading the man pages
and downloading wget onto my windows machine I used the following commands to completely spider and convert my website into pure HTML:
wget -r --html-extension -nH http://localhost:56577
wget -q http://localhost:56577/404 -O 404.html
I placed these in a shell script and bam! Instant pure HTML generation! From here it is a simple matter to do a git commit
and git push
to update my GitHub Pages repository (view here).