What is Hugo ?

Hugo is a static HTML and CSS website generator written in Go. It is optimized for speed, easy use and configurability. Hugo takes a directory with content and templates and renders them into a full HTML website.

Hugo relies on Markdown files with front matter for meta data. And you can run Hugo from any directory. This works well for shared hosts and other systems where you don’t have a privileged account.

Hugo renders a typical website of moderate size in a fraction of a second. A good rule of thumb is that each piece of content renders in around 1 millisecond.

Hugo is designed to work well for any kind of website including blogs, tumbles and docs Sites built with Hugo are extremely fast and very secure. Hugo sites can be hosted anywhere, including Heroku, GoDaddy, DreamHost, GitHub Pages, Google Cloud Storage, Amazon S3 and CloudFront, and work well with CDNs. Hugo sites run without dependencies on expensive runtimes like Ruby, Python or PHP and without dependencies on any databases.

Complete documentation is available at Hugo Documentation

Hugo Setup

First install :

  1. Git
  2. Go 1.4+
  3. Hugo
  4. Mercurial
$ sudo apt install git mercurial golang
## installing hugo
$ export GOPATH=$HOME/go  
$ go get -v github.com/spf13/hugo  
You may run go get with the -u option to update Hugo’s dependencies:
$ go get -u -v github.com/spf13/hugo

Quick start

$ hugo new site anu
$ cd anu
## Install some themes (all)
$ git clone --depth 1 --recursive https://github.com/spf13/hugoThemes.git themes
## run hugo
$ hugo server --theme=material-design --buildDrafts
# => Now browse to http://localhost:1313/ 

Specified two options here:

  1. --theme to pick which theme;
  2. --buildDrafts because we want to display our content, both set to draft status.

To learn about what other options hugo has, run:

$ hugo help
$ hugo server

To install one of theme :

$ hugo new site anu
$ cd anu
$ git clone https://github.com/pdevty/material-design themes && cd ..
### Usage
$ hugo server -t material-design -w -D

Configuration Material-Design theme

config.toml
theme="material-design"
baseurl = "Your Site URL"
languageCode = "en-us"
title = "Your Site Title"
MetaDataFormat = "toml"
paginate = 9 # To specify a multiple of 3
disqusShortname = "Your Disqus Name" # optional
copyright = "© 2015 Copyright Text"

[params]
  description = "Your Site Description" # optional
  twitter = "Your Twitter Name" # optional
  github = "Your Github Name" # optional
  facebook = "Your facebook Name" # optional
  gplus = "Your Google+ profile name" # optional
  linkedin = "Your LinkedIn Name" # optional
  headerCover = "images/headerCover.png" # optional
  footerCover = "images/footerCover.png" # optional
  googleAnalyticsUserID = "Your Analytics User Id" # optional

[permalinks]
  post = "/:year/:month/:day/:title/" # optional

Avalaible themes at here

Deploy to Github pages

  1. Create a repository and name repository with format username.github.io
  2. Clone the repository

    $ git clone https://github.com/username/username.github.io 

  3. Move all in site anu (hugo new site anu)

    $ mv anu/* username.github.io 

  4. Enter the project folder

    $ cd username.github.io
    $ hugo -d --theme=material-design

  5. Push it :

    $ git add --all
    $ git commit -m "fush"
    $ git push -u origin master

  6. You're done, go to http://username.github.io