Setup a Hugo Blog

This is just a brief summary of setting up a Hugo site. It details the specific steps for creating an initial site.

Making a new site

See articles:

Hugo Quickstart Guide

52-technologies-in-2016- hugo

Install Hugo

Get Hugo and install for your developement platform from Hugo installs

Make the initial site

$ cd <your base folder>
$ hugo new site bookshelf

Create some content

Add content by adding markdown files to /content/posts/ folder.

Add TOML metadata between +++ in each post at top of file.

+++
date = "2016-02-14T16:11:58+05:30"
draft = true
title = "good to great"

# additional params here as needed by theme (mainroad)

description = ""
tags = [
    "go",
    "golang",
    "templates",
    "themes",
    "development",
]
categories = [
    "Development",
    "golang",
]
menu = "main"
thumbnail = "img/placeholder.png"
+++

Server content on local system to test content.

# serve non-draft items
$ hugo server

# serve draft items as well
$ hugo server --buildDrafts
$ mkdir themes
$ cd themes
$ git clone https://github.com/Vimux/Mainroad.git

# serve with drafts and theme
$ hugo server --theme=mainroad --buildDrafts
  • View Site locally at http://localhost:1313/
  • Update config.toml to values to use for new site and chosen theme.
  • Customize the the theme changing the layouts, static, imgs in theme sub folders.
  • Make posts public by setting draft status to false.
# manually for with command
$ hugo undraft content/post/my-great-post.md

# serve site does not require buildDrafts argument
$ hugo server --theme=
  • Integrate Disqus by adding disqusShortName to config file.
[Params]
  Author = "Joe Someone"
  disqusShortname = "mydisqusshortname"
  • Generate static web site into /public/ folder.
$ hugo --theme=mainroad
  • Put unbuilt site into a git repo that does not include the /public/ folder.
$ echo "/public/" > .gitignore
$ git init
$ git add .
$ git commit -m "Initial commit."
$ git init  #in public folder
$ git checkout -b site-pages
$ git add .
$ git commit -m "Initial site added v0.01"
$ git remote add origin https://github.com/username/username.github.io.git
$ git push origin site-pages

Disqus shortname

My site name: mydisqusshortname.disqus.com

Universal code: https://mydisqusshortname.disqus.com/admin/install/platforms/universalcode/

Admin: https://mydisqusshortname.disqus.com/admin/

    Tom Klopfstein avatar
    About Tom Klopfstein
    Tom is a software developer who enjoys learning new things and trying to fix what's broken.
    comments powered by Disqus