Overriding Hugo Default Archetype

When I started writing this blog, I had no idea about how powerful Hugo is, and I used just basic features, leaving everything to default.

After some time of writing, my needs grew, and one of them was that I want to have a default template for my posts, one of them being the “footer”, and other one being front matter to have some more information.

The location of archetype is rootOfBlog/archetypes/default.md.

The default archetype that Hugo gives you looks something like this:


---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

One thing led to another, and I’ve added things to the archetypes file, and for this post it looks something like this


---
title: "{{ replace .Name "-" " " | title }}"

description: ""

date: {{ dateFormat "2006-01-02" .Date }}

publishDate: {{ .Date }}

lastmod: {{ .Date }}

draft: true

categories:

tags:

keywords:

---

---

You can follow me on [twitter](https://twitter.com/milosgarunovic), contact me on
[LinkedIn](https://www.linkedin.com/in/milos-garunovic/), or write me an [email](mailto:milos.garunovic@gmail.com).

Now I have a template for my posts, and “footer” that stays the same. You can see the information that can be added to archetype (and other usages) here and here.