OneBite.Dev

How to Customize Front Matter in Hugo

Slowly your Hugo app is growing, the default field you need in your front matter is not just title and date anymore, you always need to include description, tags, or any other field. Hugo provide archetypes as our default template when creating a new content.

The default location for this is in “archetypes/posts.md” or if you want in live in your theme “themes/my-theme/archetypes/posts.md”. Open this particular file and write

title: "{{ replace .Name "-" " " | title }}"
createdAt: {{ .Date }}
description: ""
tags: \[""\]
image: ""

It really depend on your needs, the above code is what i currently always write when starting a new post

hugo