How to Use Hugo Archetypes
What I Learned
Hugo archetypes are template files that help you quickly create new content with pre-defined front matter and structure. They save time and ensure consistency across your content.
Details
Archetypes in Hugo work like blueprints for your content. When you run hugo new, Hugo looks for an archetype file matching your content type and uses it as a template.
For example, with our TIL archetype at archetypes/til.md:
1hugo new content/tils/my-new-til.md --kind til
This creates a new file with:
- Pre-filled front matter (title, date, tags, categories)
- Template sections (What I Learned, Details, References)
- Proper markdown structure
You can customize archetypes for different content types, making content creation faster and more consistent.