Hugo Archetypes

As the first post to my TIL section where I’m trying to encourage myself to write more frequently on smaller topics; I learned about Hugo’s Archetypes.

The tl;dr is that archetypes is the template for new content. As such instead of typing out all of the metadata fields each time, I can type hugo new blog/<name>.md to get a new blog post and hugo new til/<name>.md. These are each defined in the archetypes folder in blog.md and til.md.

For example I use the below in blog.md:

+++
categories = []
tags = []
description = ""
slug = '{{ .File.BaseFileName }}'
draft = true
title = "{{ replace .Name "-" " " | title }}"
date = {{ .Date }}
author = "Micheal J."
+++