HUGO is a static site generator, a tool that allows us to pre-compile our website into static HTML, CSS and JS. The main benefit of an ssg is speed. A Static site takes a lot less time to load than a site that uses databases.

For more information on HUGO read my other post Hugo Static Site Generator


  • Git

Installing HUGO

Official steps

The HUGO binary is used to initialize our site then create posts etc… Below are the steps for MacOS and Arch based Linux distros.


brew install hugo


sudo pacman -S hugo

Confirm Installation

hugo version

Create your site

This assumes choices for you, i.e the theme used.

The settings in this guide will mimic the base config of my site

hugo new site -f yml <your-sitename>
cd <your-sitename>
git init
git submodule add --depth=1 themes/PaperMod
echo "theme: 'PaperMod'" >> config.yml

Create Content

We will now begin adding new content to our website. Lets create our first post.

Lets start by creating a template for our posts.

vim archetypes/

Paste the following base template

title: { { replace .TranslationBaseName "-" " " | title } }
date: { { .Date } }
author: "<author>"
draft: true

tags: [""]
description: ""
canonicalURL: "{{ .Page | absURL }}"

  image: "<image path/url>" # image path/url
  alt: "<alt text>" # alt text
  caption: "<text>" # display caption under cover
  relative: false # when using page bundles set this to true

## **Introduction**

## **Conclusion**

If the posts folder does not exist, create it

mkdir content/posts

Create and edit a post

pick an editor of your choice. I use NVIM BTW

hugo new posts/<post-name>.md
vim content/posts/<post-name>.md

Start the server

Now that we have created our site, installed a theme and created a post lets start the server.

hugo server -D

The -D flag tells hugo server to build drafts. (notice how we have a draft: option in our posts template.) Of course once you have finished a post you set draft to false like so draft: false

➜  hugo server -D
Start building sites …
hugo v0.109.0+extended darwin/arm64 BuildDate=unknown

                   | EN
  Pages            | 10
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  0
  Processed images |  0
  Aliases          |  2
  Sitemaps         |  1
  Cleaned          |  0

Built in 12 ms
Watching for changes in /home/ahmza/prj/ahmza/{archetypes,assets,content,data,layouts,static,themes}
Watching for config changes in /home/ahmza/prj/ahmza/config.yml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address
Press Ctrl+C to stop

Notice the second line to the bottom. Web Server… This line gives you a localhost URL that you can use in your browser to view your site locally.

Configure Site

Open the config.yml file in a text editor.

vim config.yml

Important changes you need to make

Here is my config.yml with bits redacted so you can fill them in

baseURL: "<your sites URL>"
title: <your site title>
paginate: 5
theme: PaperMod

enableRobotsTXT: true
buildDrafts: false
buildFuture: false
buildExpired: false
enableEmoji: true

googleAnalytics: <Google Analytics Tag>

  disableXML: true
  minifyOutput: true

    - HTML
    - RSS
    - JSON

  env: production # to enable google analytics, opengraph, twitter-cards and schema.
  title: <title>
  description: "<description>"
  keywords: [Blog, Portfolio, PaperMod]
  author: <author>
  images: ["<link or path of image for opengraph, twitter-cards>"] #Change this
  DateFormat: "January 2, 2006"
  defaultTheme: auto # dark, light
  disableThemeToggle: false

  ShowReadingTime: true
  ShowShareButtons: false
  ShowPostNavLinks: false
  ShowBreadCrumbs: true
  ShowCodeCopyButtons: true
  ShowWordCount: true
  ShowRssButtonInSectionTermList: true
  UseHugoToc: false
  disableSpecial1stPost: false
  disableScrollToTop: false
  hideFooter: false
  comments: false
  hidemeta: false
  hideSummary: false
  showtoc: true
  tocopen: false

    # disableHLJS: true # to disable highlight.js
    # disableFingerprinting: true
    favicon: "/img/favicon.png"
    favicon16x16: "/img/favicon.png"
    favicon32x32: "/img/favicon.png"
    apple_touch_icon: "/img/favicon.png"
    safari_pinned_tab: "/img/favicon.png"

    text: "<Home>"
    icon: /img/favicon.png
    iconHeight: 35

  # profile-mode
    enabled: true # needs to be explicitly set
    title: "Welcome \U0001F44B"
    subtitle: "<subtitle>"
    imageUrl: "/img/favicon.png"
    imageWidth: 120
    imageHeight: 120
    imageTitle: "my image"
      - name: posts
        url: posts
      - name: archive
        url: archives
      - name: tags
        url: tags

  # home-info mode
    Title: "Welcome \U0001F44B"
    Content: "subtitle"

    - name: LinkedIn
      url: ""
    - name: gitlab
      url: ""

    hidden: false # hide everywhere but not in structured data
    hiddenInList: false # hide on list pages and home
    hiddenInSingle: false # hide on single page

    URL: "<user>/<repo>/-/blob/main/content"
    Text: "Suggest Changes" # edit text
    appendFilePath: true # to append file path to Edit link

  # for search
    isCaseSensitive: false
    shouldSort: true
    location: 0
    distance: 1000
    threshold: 0.4
    minMatchCharLength: 0
    keys: ["title", "permalink", "summary", "content"]

    - identifier: posts
      name: posts
      url: /posts/
      weight: 1
    - identifier: archive
      name: archive
      url: /archives/
      weight: 10
    - identifier: tags
      name: tags
      url: /tags/
      weight: 20
    - identifier: search
      name: search
      url: /search/
      weight: 30
# Read:
pygmentsUseClasses: true
    noClasses: false
    codeFences: true
    guessSyntax: true
    # lineNos: true

Run the server again

Run the server and check out your hard work. Change settings make posts etc. Have fun !!

hugo server -D

Publish your site

Once you are happy with your site, you may want to publish it to the internet.

In the next post Publishing your HUGO site I will cover a basic method of publishing your site as well as a more complicated but automated workflow that I use.


Through this post you have learned to create your own HUGO site as well as create and edit posts. We also learned about

  • archetypes
  • Mark posts as drafts
  • The HUGO built in server
  • webp + webm (still need to add this)
  • shortcodes (still need to add this)