โšก Onwuachi Control Plane

Hugo Front Matter: Metadata as Code

Overview

Every content page in Hugo begins with Front Matter.

Front Matter is structured metadata that tells Hugo how a page should be rendered, organized, and displayed. Although it may look like a small block of configuration at the top of a Markdown file, it is one of the most important concepts in Hugo because every page passes through it during the build process.

For infrastructure engineers, Front Matter is best understood as metadata for content, much like variables and configuration files are metadata for infrastructure.

Why It Matters

Without Front Matter, Hugo only sees a Markdown document.

With Front Matter, Hugo understands:

Nearly every Hugo feature depends on information defined in Front Matter.


The Big Picture

Hugo Front Matter vs Terraform Workflow

Just as Terraform separates configuration from execution, Hugo separates content from presentation.

The Markdown file contains the article, while the Front Matter provides the structured data Hugo needs to generate the final website.


What is Front Matter?

Front Matter is the metadata block located at the beginning of every content file.

For example:

+++
title = "My First Hugo Page"
date = 2026-07-06
draft = false

tags = ["hugo","documentation"]

categories = ["Infrastructure"]
+++

Everything above the closing +++ is Front Matter.

Everything below it is the Markdown content that becomes the page.


Supported Formats

Hugo supports three Front Matter formats.

TOML

+++
title = "Example"
draft = false
+++

Uses +++


YAML

---
title: Example
draft: false
---

Uses ---


JSON

{
  "title": "Example",
  "draft": false
}

Used less frequently but fully supported.


Anatomy of Front Matter

A typical page contains fields such as:

FieldPurpose
titleDisplay title
datePublication date
draftPublish or hide page
descriptionShort page description
summarySearch and preview text
tagsCross-reference related content
categoriesOrganize articles
weightManual ordering
typeSelect layouts
aliasesRedirect old URLs

Hugo also allows custom fields.

For example:

proof = 100
distillery = "Jim Beam"
rating = 8.5

Those fields can later be displayed inside templates.


Engineering Analogy

Front Matter becomes much easier to understand when compared to Terraform.

HugoTerraform
Front Mattervariables.tf
MarkdownResource definitions
TemplatesTerraform engine
Generated HTMLInfrastructure resources
Buildterraform apply

Both systems follow the same pattern:

Configuration

โ†“

Processing Engine

โ†“

Generated Output

Instead of building EC2 instances, Hugo builds web pages.


Real-World Example

The bourbon bottle reviews in this knowledge base use a custom Front Matter schema.

brand = "Knob Creek"

expression = "Smoked Maple"

proof = 90

rating = 8

would_buy_again = true

Those values aren’t part of Hugo itself.

They are custom metadata created specifically for this project.

The same approach could be used for recipes, AWS services, architecture documents, or runbooks.


Best Practices


Common Mistakes


Key Takeaways


Related Articles


Official Documentation


References

System Context

โ† Back to Kb