Interact with this post using Mastodon or
Using a blog template
The repetitive part of creating a blog post is completing the front matter, but this can be simplified using automation.
All you need to pre-populate your post front matters is a simple blog.md template in your achetypes theme folder.
Here is a very basic one to get you started:
+++
title = ""
url = "/{{ replace .Name "-" " " | title }}/"
date = "{{ .Date }}"
tags = [{{ range $name, $taxonomy := .Site.Taxonomies.tags }}"{{ printf "%s" $name}}"{{ end }}]
series = [{{ range $name, $taxonomy := .Site.Taxonomies.series }}"{{ printf "%s" $name }}"{{ end }}]
+++Executing the command hugo new blog/post_name.md will create a blog post in your blog directory with the above url field changed to /post_name/
Let’s see what the rest of the code is doing:
- the date field is replaced with the post’s creation date
- the tags field is replaced with a list of all tags ever used. This makes easier to remember them
- the series field is replaced with a list of all series names ever used. This makes easier to keep track of them. More about the use of post series here
✄ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈