Hugo: Ditching WordPress to Static Site Generator

Posted on
Hugo: Ditching WordPress to Static Site Generator

Introduction

I read a lot of articles every morning. I came across to this developer. He got some trouble in his current website and introduce a tool – Hugo. At first I was reluctant on his post but I read anyway. 😀 Reads about Hugo. I don’t usually adapt new tools without looking at it. I use to think of longetivity – stability of the application. Until I convince my self. How about we try it.

Installation

Hugo is easy to install. It support lots of binaries to get you started. In ubuntu you can use the snap package installer and you are set.

snap install hugo

You can then build your website templates. If not, there were lots of available themes for you to choose from. I use Hugo Future Imperfect. If you find it hard to manage. New themes would mean additional repo or files. Use .gitsubmodules and let git manage your themes.

Configuration

Hugo is somewhat similar to symfony in terms of configuration. By default, the configuration is within ./config.toml file. This is the main config file but you can customize it by setting the config: "config.yaml" or config: "config.json". Just like above, I use a theme, thus, it goes with more configuration. All I need is to check the theme. Add them into my config file.

Usage

If you’re familiar with command line interface (CLI) and with nodejs. Hugo would be easy for you. Once everything is setup. You can fire up the server to test your changes before publishing your new website.

Running the server locally for development. This will run a httpd server.

hugo server

Remove the server if you want to build your site for production. The generated files will go into public/directory. Serve it into your http server. Or you can use the hugo built in server command.

hugo server --baseURL=https://inoc.me/ --port=80 --appendPort=false --bind=YOUR_IP

There were lots of available commands for Hugo. Type hugo --help to get them.

Conclusion

There were lots of new tools emerging today. All we have is to explore them. I have already converted my WordPress website into a static website and it’s awesome. How about I mention, writing posts in markdown. Isn’t it awesome? Notable mention Jekyll.

For more comprehensive documentation about Hugo visit their website https://gohugo.io/.