Archetypes in Hugo
Archetypes are templates for new content. When you create a new post with:
hugo new blog/my-post.md
Hugo looks for an archetype to determine the front matter structure.
1. Where Are Archetypes Stored?
- Global default:
archetypes/default.md
- Section-specific:
archetypes/blog.md
(forcontent/blog/
)
2. Example of an Archetype (archetypes/blog.md
)
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
author: "Your Name"
tags: []
---
When you run hugo new blog/my-post.md
, it creates: