Imagine you need to write a to-do list on a piece of paper. You just write:
buy milk
call mom
walk the dog
Everything is clear and easy to read. Computers also sometimes need to store lists and settings. But often this is done in heavy formats with lots of brackets and quotes (for example, in JSON format). Such entries are inconvenient for humans to read.
This is where YAML comes in. It's a way to record data almost like a regular list in a notebook. It was created specifically so that people can easily read and write settings, and computers can easily understand them.
What YAML looks like
For example, you have a shopping list:
groceries:
- milk
- bread
- cheese
The computer will understand that you have a category groceries, and inside it — three
items. It's easy to read, and looks familiar.
Where YAML is used
You can find YAML in many places:
- in application settings;
- in automation tools (for example, GitHub Actions);
- when working with containers (Docker Compose);
- in server and website management systems (Kubernetes);
- in website generators (for example, Hugo).
Essentially, YAML is a universal language for describing "what and how things should work".
Analogy: moving house
Imagine you're moving. You need to write down which boxes go where.
kitchen:
boxes:
- dishes
- pots
- pans
bedroom:
boxes:
- clothes
- bed linen
It's immediately clear: the kitchen has its own boxes, the bedroom has its own. Simple and logical.
Example: an article's "card" in Hugo
Website generators like Hugo use YAML to store information about the author and article. This block of data is called front matter (it goes at the beginning of the file).
---
title: "Мой первый пост"
author: "Алексей Иванов"
date: 2025-08-23
tags:
- blog
- notes
- YAML
---
Thanks to this, the site understands: what to name the page, when it was published, who the author is, and what tags to add. Everything is stored compactly and clearly.
What types of data are there in YAML
YAML can store different data types:
- strings
"текст"); - numbers (for example,
42or3.14); - boolean values
true/false); - lists (several elements in a row);
- objects (data with nested categories).
Thanks to this, you can describe both simple notes and complex configurations.
Why YAML is convenient
- Fewer unnecessary characters. No brackets or quotes at every step.
- Reads like a list. Indentations show nesting.
- Suitable for various tasks. Can store both simple lists and complex settings.
The main rule of YAML
In YAML, everything relies on indentations. Indentations = levels. If spaces are placed incorrectly, the computer will get confused. Therefore, it is important to be careful.
Summary
YAML is a language that looks like your notes, but is understandable to a computer. It allows you to easily describe lists, categories, and even entire systems.
Its popularity is simple: YAML makes settings human-readable and machine-friendly.