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?. 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 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 out there!
So Why Hugo? Here Are My Reasons:
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!
Hugo was built on Go, which gives it an unparalleled production speed. Check out David's Performance Test on freeCodeCamp 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.
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.The list Hugo themes 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 guide, so definitely check it out. Regardless, here's an overview:
- Install Hugo
-
Create the site locally using the
hugo new site <DIRNAME>
command. - Choose a Hugo theme & add it as a submodule inside the
<DIRNAME>
. -
Add content using the
hugo new <FILENAME.md>
command. -
Check if your site is fine as per your requirements using the
hugo server
command. - And finally, build the 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>
repository on GitHub & push your local repository up there. - Login to Netlify & click on "New site from Git" which should take you to the following page:
- Click on the
GitHub
button & select the appropriate repo as the image below.
- Under
Basic Build Settings
type theHugo
command &Publish
under the "Build Command" & "Publish Directory" respectively.
- Deploy site! Change the URL to something that's more human-readable & that's it.
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?
Cover Photo by Sydney Rae on Unsplash
Top comments (0)