Hugo Commands and Config

Table of Contents

Some Hugo commands and config.

New site

hugo new site <site name>  # Create Hugo site folder <site name>.

New post

hugo new post/
hugo new <archetypes>/<post name>.md

Add section

A new section requires:

  • An archetype file.
  • A inside section folder.
  • A [menu] entry in config.toml.

Following example creates a section call section9(1).


Copy archetypes/ to archetypes/ and modify type:

type: "section9"
date: {{ .Date }}
author: "John Siu"
title: "{{ replace .Name "-" " " | title }}"
description: ""
tags: [""]
draft: true

Value of type will be section directory name. See below.


Create a under section9

hugo new section9/

That will create directory section9 under content with insdie. Create to set the title:


Title: "Section 9 / 公安9課"

Add a menu entry else the new section will not be shown:


name="公安9課" # Menu item.
url="/section9" # Match the directory name under `content`.

Syntax Highlight

Enable syntax highlight in config.toml:

pygmentsCodefences=true # Enable syntax highlight.
pygmentsStyle="Chroma"  # Define highlight style.


Ssh rsync public folder to remote server:

rsync -az --delete public <user@hostname>:<dir containing public>


John Siu
Minimize the Effort, Maximize the Effect!
comments powered by Disqus