I know, I know, the very first question I receive when people hear “How to setup a blog” is: “Why the hell you need to setup a blog if Facebook, Blogger, Wordpress, Medium and the next Big Thing exist?”
If this is the first question that comes to your mind — you probably do not need one. The only reason to have your own blog is a desire to have a control over it.
This is fine. Here are a few reasons for having a separate blog:
- adding contact me / about me / email subscription buttons
- being able to modify structure, theme, add any feature you want to (at least it’s fun)
- being able to work on SEO, not all blogging engine provide you with a good search optimization for your username and, sorry, I a not sharing my google traffic
- you control advertising (or absence of it, ADs are the cancer of 21st century and everyone tries to avoid it)
- custom domain and direct links to only your content
- and tons of other reasons you can think of
Approved, where do we start?
I will go from the easiest option to harder. No need to get a bare metal or dedicated server from DigitalOcean, we are not enemies to ourselves.
In particular, here we will be talking about Static Site Generators, yes, this is one more post on SSG. During the last 2 month I’ve done an analysis of most popular solutions, tried 3 of them and ended up with Go :party:
What are the options
My most favorite SSG are:
There are other engines which might be a better choice for you, however my main factors were shipping time, speed and convenience of use. Disclaimer, I do not want to learn a new language just to keep a blog and all interactions with SSG have to be close to 0.
Jekyll is awesome, because Ruby is awesome, because Matz is awesome and because GitHub Pages are outstanding. Some time ago you could not keep sources private and HTTP traffic secure, however it is 2018 now, and GitHub improved greatly.
Jay has tons of themes and it is extremely easy to setup in GitHub. Jekyll is definitely a way to go if you are looking for an SSG.
Now, let me explain what is the downside here. I like Ruby, really, it is an awesome duck-typing language which is outstanding for web prototyping and DSLs, however I do not like to manage environments too much. Since my main language is Python there are already conda, pip, pipenv and who knows what else lives on my machine. In my humble opinion SSG in python sucks and managing rvm or rbenv will not make my life easier. So, sorry, Jekyll, you are a nice guy but we have to break up, the problem was me.
Oh Great Gatsby, let run a party? JS is a king these days, is in it? Ok, ok, do not throw tomatoes at me. Really, let’s face the reality, JS has done huge progress in recent years and it is mainstream already for quite a while.
As we are about to use a framework, an SSG framework, not that much a language itself, what are the pros of Gee?
Here is a list of companies who use it: — Facebook (React docs) — Nike (Just do it Campain) — AirBnB — Snapchat — and who knows else
Btw, Gatsby is officially a startup so you are using a well-funded product.
For me here are the pros of the framework:
- dozens of themes for the blog
- is under active development and adopted by big companies
- ease of use
- actively evolving
In my opinion, the adoption of Gatsby will only grow and the framework itself will become better and easier. I am sure you will find more reasons to add it to your arsenal.
Cool, do I use it?
Gatsby is awesome, no doubts about it, but there are 2 things that stopped me. First of all, I still remember times when developing a website sucked and sucked a lot. Nowadays it is not an issue that much, however there is still a taste of sadness on the tips of my fingers when JS is used.
Sorry, you can evaluate
'3' + 2 and
'3' - 2 as an excuse. Yeah, yeah, the reason is pretty obvious, but I want it to be logical!! Not obvious!
The second reason is I am an engineer and there is always a brand new thing we all want to give a shot. Why not try something else? Ready?
GoHugo is an SSG written in Go. Yes, this is one more post about Go. And Static Site Generators. And personal blogs. And all that stuff, you know. It states that Mister H is the world’s fastest framework markdown renderers which could be true. I have not tested by my own the performance of any of the previous options. You are an engineer, how could you? I am sure all of them are good enough which is good for me.
Ok, so you wanted to write some Go?
Nah, I did not want to. An interaction with a framework and its language should be close to 0. I want to write some f##king markdown and get an HTML. And on top of thaaaat.. I want a theme! Dozens of themes! And analytics.. And discuss comments.. And continious deploy.
So here is a list of advantages for me:
- Around 160 themes
- Easy to manage engine (get a go and do
brew install hugo)
- Supported on most of SSG hostings
- Good documentation and community (Gatsby wasn’t that good a year ago)
- actively evolving
From the comparison above it seems to be not that good as Gatsby, however I really like the way GoHugo is built, organized and managed so decided to give it a shot. After a few months, it ended up being.
I have an engine. What’s next?
We’ve chosen an engine already, where to go next from here? If you decided to go with Jekyll — GitHub Pages is your ally here. For Gatsby and GoHugo my personal choice stopped at Netlify. Even more, it was more of a battle of GitHub Pages VS Netlify and guess who won here?
If you have not used Netlify before here are steps you do to run a blog.
- Put your blog under version control (
- Configure your remote repo in the Netlify (you can use GitHub, GitLab or Bitbucket. I tried all of them and stayed with GitHub just because I like green dots of commits)
- Select an engine
- Add your domain
- Boom! You are done.
Let’s go through the process again.
I will be using GoHugo + Netlify in the example.
Step 1. Install Hugo
You would need to have
GoHugo installed. A full installation step can be found here
A manual process is next:
- Go to the official Go website and install the language. Guide
- You probably have Git installed already if you are reading this, but if not here is a guide
- Do ‘brew install hugo’ or
sudo apt-get install hugo(Sorry windows, you have it’s own path)
Step 2. Configure blog.
Here is a full guide on how to create a blog
- I used the following command
hugo new site tarasmatsyk.com
- Go to the folder and initialize git
cd tarasmatsyk.com && git init
- Pick a theme here and add it
git submodule add https://github.com/htr3n/hyde-hyde.git themes/hyde-hyde
- Create a new post
hugo new posts/how-to-run-a-blog-under-2-hours.md
- Add some content. Make sure you set
falsebefore deploying it. You can test drafts in debug mode by running
hugo server -D
Step 3. Deploy it.
- Commit the changes to git. Create remote repo either in BitBucket, GitLab or GitHub.
- Push all the changes to the repository of your choice. Mine is here, for instance.
- Make sure you have domain or accept the fact that Netlify will give you a random one.
- Deploy config, domain, SSL, autodeploy are pretty easy and took me about 20 minutes. If you need a better guide on how to host Hugo on Netlify, here is a link to the official (documentation)[https://gohugo.io/hosting-and-deployment/hosting-on-netlify/]
There are other options than Netlify, however, I really like them and never ever had an issue with hosting. As soon as you deployed a website, feel free to go the configured domain (or you a provided one) and enjoy the work done.
This blog has been built using GoHugo and Netlify and it was damn easy. All of it, should take about an hour, maybe 2 if we include domain selection and purchase into the process.
Hope you enjoyed the reading and looking forward to seeing your blog in Hugo. Or Gatsby. Or Jekyll. Or your own framework.
Now, we can start a holy war and answer the question of Which framework do you use and why?
Originally published at tarasmatsyk.com on November 22, 2018.