Troubled Setting Up Your Own Blog? Then Try Out What I did.
Tags: blogging, hugo
Published: 2020-04-02 10:41:21

Earlier the other day, I shared my thoughts on why Data Scientists should try their hands on blogging. You can read more on it at [As A Data Scientist, What's Your Excuse to Not Blog?](https://dev.to/jarmosan/as-a-data-scientist-what-s-your-excuse-to-not-blog-5cm). It took me a while but it eventually hit me.

Stating how to do it might benefit more than blatantly stating why they should do it instead. So I decided to share this article as a "hand-held" guide to setting up one's own blog!

I used [Hugo](https://gohugo.io/) which is an extremely fast Static Site Generator & also one of the most popular ones, on par with Gatsby & Jekyll. In fact, [Netlify ranks it in no.3 as the most popular SSG](https://www.netlify.com/blog/2016/05/02/top-ten-static-website-generators/) out there!

## So Why Hugo? Here Are My Reasons:

1. As a Data Scientist, **I want to abstract my web development workflow** as much as possible. This way I'm focused on delivering DS/ML stuff than actual Web Dev stuff. If you're comfortable with CLI, Hugo will be your best friend as you'll see further into the post. Trust me on that!

2. Hugo was built on Go, which gives it an unparalleled production speed. Check out [David's](https://www.freecodecamp.org/news/author/learnitmyway/) [Performance Test on freeCodeCamp](https://www.freecodecamp.org/news/gatsby-vs-hugo-a-detailed-comparison-e78d94f640fc/) where he got whooping 8.7 seconds load speed on a 2G connection. I wondered if all I want is to deliver reading resources for my audience, it doesn't matter if I've a login system or a backend system, etc. A simple easy-to-setup, fast & static blog is all I needed.

3. There're no additional dependencies to download onto my computer! Yes, you read it right. I didn't even have to download Golang to install Hugo. How cool is that? Simply download the required binary, install to `$PATH` & you're good to go.

4. The list [Hugo themes](https://themes.gohugo.io/) rival that of the ones available for Gatsby. Coupled with the ease of use, quick development time & modern-looking themes I couldn't find any reason to look elsewhere. Read ahead & I'll definitely suggest some themes for you to check out on your blog.

## Now The Guide You've Been Eagerly Waiting For.

Downloading & installing Hugo locally is fairly straightforward. Also it's very well documented in the official [Getting Started](https://gohugo.io/getting-started/installing/) guide, so definitely check it out. Regardless, here's an overview:

- [Install Hugo](https://gohugo.io/getting-started/installing/#quick-install)
- [Create the site locally](https://gohugo.io/getting-started/quick-start/#step-2-create-a-new-site) using the `hugo new site <DIRNAME>` command.
- Choose a [Hugo theme](https://themes.gohugo.io/) & [add it as a submodule inside the `<DIRNAME>`](https://gohugo.io/getting-started/quick-start/#step-3-add-a-theme).
- [Add content](https://gohugo.io/getting-started/quick-start/#step-4-add-some-content) using the `hugo new <FILENAME.md>` command.
- [Check if your site is fine](https://gohugo.io/getting-started/quick-start/#step-5-start-the-hugo-server) as per your requirements using the `hugo server` command.
- And finally, [build the static pages](https://gohugo.io/getting-started/quick-start/#step-7-build-static-pages) using the `hugo` command.

That's it! You're done, well almost! But rest assured the scary part is far behind you now. 

## Hosting The Site

- So create a [`<REPO_NAME>`](https://repo.new) repository on GitHub & push your local repository up there.
- Login to [Netlify](https://app.netlify.com) & click on "[New site from Git](https://app.netlify.com/start)" which should take you to the following page:

![Create a New Site on Netlify](https://dev-to-uploads.s3.amazonaws.com/i/3to3i0dfijggjlzxbrws.jpg)
 
- Click on the `GitHub` button & select the appropriate repo as the image below.

![Select GitHub repo for Netlify to build the site from](https://dev-to-uploads.s3.amazonaws.com/i/dbbbkczk6aur998bzxsb.jpg)

- Under `Basic Build Settings` type the `Hugo` command & `Publish` under the "Build Command" & "Publish Directory" respectively.

![Deploy the site live](https://dev-to-uploads.s3.amazonaws.com/i/xauvvfrbcu9ebihr7zsb.jpg)

- Deploy site! Change the URL to something that's more human-readable & that's it.
![Change the URL name to something more human-readable](https://dev-to-uploads.s3.amazonaws.com/i/3ja5uy6p2a8gcs9wqj5m.jpg)

You're done! Your personal blog was developed & deployed in less than an hour. If it's that easy I really wonder, [_As A Data Scientist,s What's Your Excuse To Not Blog?_](https://dev.to/jarmosan/as-a-data-scientist-what-s-your-excuse-to-not-blog-5cm)

Cover Photo by [**Sydney Rae**](https://unsplash.com/@srz?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/encourage?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)