How to Start Blogging with Hugo and Windows

How to Start Blogging with Hugo and Windows10
Everyone is now busy to launch website or blog and in my opinion its a really good trend.

But choosing a language or platform for new planned website or blog is really tough.

If you asked anyone about which platform they used for blogging or want to use or what they recommend you to use?

They told you about a WordPress or Blogger.

But,

When you searched on Google, You find tons of topics about a comparison between two language or two software or dynamic vs static sites and this is really frustrating.

You can’t decide easily what you choose for your next projects.

But, If you obsessed with speed like me.

You found a Static Websites lots faster than Dynamic Websites.

You should apply many tricks to make things faster in dynamic websites like buying a Powerful Server or VPS, Caching everything in RAM, Add Reverse Proxy in front of server or websites.

But, You can’t beat the performance of website which is static in nature.

According to Google Trends, Static Site Generator gain Interest in webmaster and normal User.

Static Site Generator Google Trends
Static Site Generator Google Trends

But the question is,

What Static Site Generator Does? or Why we use Static Blog Generater?

Static Website means no work done on your web server.

Static Site Generators takes your content, blend it with predefined templates and make full-fledged HTML website in your local environment.

The main advantage of Static Blog Generators is you only need a server which is able to show HTML pages and every server in the world capable of showing an HTML out of the box. No dependency needed.

In this tutorial, I’ll show you How to Install Hugo in your Windows Environment.

Note: For this tutorial i am using a Hugo 0.15 and Windows10. This steps also valid for Windows7, but if you face any difficulties. Comment it below.

What is Hugo?

Introducing Hugo, a new idea around making website creation simple again. Hugo flexibly works with many formats and is ideal for blogs, docs, portfolios and much more. Hugo’s speed fosters creativity and makes building a website fun again. – Hugo

Hugo is a Static Blog and Site Generator written in Go language.

Go language founded at Google and its a static typed language.

Due to static in nature, Hugo is a very fast and not have any dependencies like Octopress or Hexo.

Download a single binary and make your new blog. It’s Easy, Isn’t it?

Let’s we start to setting up Hugo in windows and start our first blog.

Blogging With Hugo

Setting up Hugo in Linux or Mac is really easy where its little tough in Windows.

For this tutorial, we install a Go Binary, Git, Hugo.

Install Git

I am using git for console purpose, you can use command line of windows.

Go to Git Download Page and download and install the proper software according to your operating system architecture.

Install Go Binary

1. Go to Download Page of Go Lang and download and install the proper software according to your operating system architecture.

2. To make things simple, use the default installation path at C:\Go

3. Ensure the Go binaries (found in C:\Go\bin) are in your Path system environment variables. To check in Windows7 click System, Advanced system settings, Environment Variables… and open Path under System variables. To check in Windows10 search Advanced system settings in search present in bottom of screen and every thing is same as above procedure.

Go binaries in System Variables
Go binaries in System Variables

4.Confirm it using command line. Start it and type go version

Command Line Go Version Confirmation
Command Line Go Version Confirmation

5. Setup your Go workspace. This consists of three folders at the root

bin/
pkg/
src/

Create a C:\Projects\Go folder as root Go workspace.

Go Workspace Folder
Go Workspace Folder

6. Create the GOPATH environment variable and reference your Go workspace path. To add, click Advanced system settings, Environment Variables... and click New... under System variables.

New System Variable for Go Path
New System Variable for Go Path

7. Set the variable name to GOPATH and value to your Go workspace path (e.g. C:\Projects\Go)

GO Path Setting
GO Path Setting

You can quickly check to make sure your path has been set by opening the command line and typing echo %GOPATH% and check the output.

Command Line Confirmation for Go Path
Command Line Confirmation for Go Path

Now it’s done.

Install Hugo

1. Go to Hugo Download Page. Download appropriate binary. Download Carefully. Download 64bit Version if your system supporting 64bit version.

2. Unzip download zip. You find hugo_0.15_windows_amd64.exe rename it to hugo.exe.

3. Place it to C,Windows,System32.

Start Your New Blog

1. Start Git Bash or Command Line, Type this command to create your new blog

hugo new site ~/Desktop/techelexhugo
Website Creation Command in Hugo
Website Creation Command in Hugo

It makes your new blog or Website in Desktop. Change techelexhugo with your desired name.

2. Go to your blog or website folder.

3. Download a new theme, i choose Casper theme for Hugo. Download using below command.

mkdir themes
cd themes
git clone https://github.com/vjeantet/hugo-theme-casper casper

4. After creating website, edit configuration folder config.toml. Change the blog’s base URL and title, add its author.

baseurl = "http://yourusername.github.io/"
languageCode = "en-us"
title = "My Awesome Blog"
[params]
  author = "My Awesome Name"

5. Create some post with following command.

hugo new post/your-awesome-post.md

Open it and start to writing.

6. Start local server to check all thing working fine.

hugo server -t=casper

7. Now it’s time to upload it’s to Github.

8. For deploying the static HTML files that will be generate in public on yourusername.github.io repository, map the repository to public as a git submodule.

git init
git submodule add [email protected]:yourusername/yourusername.github.io.git public
hugo -t=casper  #Build the project
cd public #Go To Public folder
git add -A #Add changes to git
git commit -m "your message" #Commit changes
git push origin master #Push source and build repos

Now your blog is deployed on Github, check in your browser.

If you get any type of error or queries, please drop in the comments section below.

If you start Blogging with Hugo and Windows, Share it with your friends.

4 thoughts on “How to Start Blogging with Hugo and Windows

  1. Siddaiah Thirupati

    Hi Shaikh,

    I am using WordPress I don’t anything about static blogs, by seeing Google trends I am surprised to see there is huge growth in static blogs, I think this article will help other techies to implement Hugo with Windows, thanks a lot for sharing the information, see you soon with another article.

    • Shaikh Masood Alam

      Thanks for your words and happy to see you again.

  2. A how-to on using Hugo hosted on WordPress. Lovely.

    • Shaikh Masood Alam

      This post first publishes with Hugo platform, then I migrate to WordPress.

Leave a Comment

12 Shares
Tweet
Share
+1
Share
Pin