/ mozey.co / blog

gohugo

April 1, 2016

🔗 Install

Don’t use brew, might be outdated

brew update && brew install hugo
brew unlink hugo

Install from source

go get github.com/kardianos/govendor
govendor get github.com/spf13/hugo
# Lots of stuff breaking...

Just download the binary and install manually

cd www
wget https://github.com/spf13/hugo/releases/download/v0.19/hugo_0.19_macOS-64bit.zip
unzip hugo_0.19_macOS-64bit.zip
ln -s hugo_0.19_darwin_amd64/hugo_0.19_darwin_amd64 hugo
./hugo version

🔗 What is Hugo?

Hugo is a static site generator. Unlike other systems which dynamically build a page every time a visitor requests one, Hugo does the building when you create your content.

Hugo is optimized for website viewing

🔗 Quickstart

hugo new site NAME

hugo new post/good-to-great.md

mkdir themes && cd themes && \
git clone https://github.com/mozey/hugo-theme-mozey.git

hugo server --theme=hugo-theme-mozey --buildDrafts

🔗 Make post public

hugo undraft content/post/good-to-great.md

🔗 Integrate Disqus, edit config.toml

[Params]
    Author = "NAME SURNAME"
    disqusShortname = <DISQUS_SHORTNAME>

🔗 Generate website

./hugo --theme=hugo-theme-mozey

public folder can be deployed to a server

To preview

 ./hugo server --theme=hugo-theme-mozey --watch

🔗 List directory layout tree ./NAME

website/
├── archetypes
├── config.json
├── content
│   └── post
│       └── good-to-great.md
├── data
├── layouts
├── public...
├── static
└── themes...

🔗 archetypes

hugo new adds a few configuration properties to the post like date and title, define your own configuration properties with archetypes

🔗 config.toml

Can also use YAML and JSON

🔗 content

Website sections, i.e. blog, article, or tutorial

🔗 data

Configuration files, can be YAML, JSON or TOML

🔗 layouts

Specify how your content will be converted into the static website

🔗 static

Images, CSS, JavaScript or other static content

🔗 Creating a theme

hugo new theme hugo-theme-mozey

🔗 Some content not showing up in google search results?

Possibly because “It is thin. It needs more than a couple lines of original text” or “It doesn’t have enough reputation or links. A page may be buried too deep in your site to rank. Any page without external links and more than a few clicks from the home page is unlikely to get indexed.”

See this