How to Create and Deploy Hugo Site With Github Pages
Contents
What is Hugo?
Hugo is a static site generator by written in Go. I was looking for any generator to publish something nowadays. I have been using WordPress for a personal blog before. But that looks boring to me anymore. I came across Hugo framework. I loved it. I highly would like to suggest you to use that framework. There are also a lot of alternatives. You can find them by surfing. I just installed Hugo to my local and published via GitHub Pages. I would like to start posting this installation and deployment steps that I just followed.
How to install Hugo?
Hugo Framework has a well-documented website. I did use Homebrew to install it. You can start quickly by following this page
How to host your Hugo site on GitHub?
- You create a GitHub repository that called
<github-username>.github.io
- You create a new hugo site on your local environment.
|
|
- You should choose a theme from official list.
- You must go to your hugo site directory like
my-awesome-blog
and clone your choice.
|
|
- After you update your
config.toml
for your new theme and website configuration, you run the following command when you inside the blog directory and you should see first look about your awesome blog.
|
|
Go to http://localhost:1313/ to see everything.
- Next steps are about to deploy/publish your awesome blog. You remove public directory and add your repository as public.
|
|
- You can create something (post or static page) via hugo CLI now. After that, you run
hugo -t <your-theme-name>
. This command creates rendered files to publish intopublic
directory. This means your repository needs to commit and push. You should go to public directory by runningcd public
and send your last changes to remote repository you created before.
|
|
- Finally! You can go to your awesome blog by typing
<github-username>.github.io
.
Author Bilal Baraz
LastMod Sunday, April 26, 2020