Basic

Content as data with a shape

A page has a body and it has facts about the body. The facts are the front matter, and the front matter is what a template reads.

What you will see

One line with a default. A written default is what keeps the set small.

About 1 min of reading

Try It

Check the required set

1

Write the required names

printf 'title\ndate\n' > /tmp/r.txt; wc -l < /tmp/r.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
2. Two names is the set, and the set is small.
2

Attempt a file missing one

printf 'title only\n' | grep -c -f -x /tmp/r.txt /dev/stdin | awk '{print ($1==2) ? "ok" : "refuse file named"}'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
refuse file named. The refusal names the file, which is the place.
3

Write a default

printf 'draft default=false\n' > /tmp/d.txt; cat /tmp/d.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One line with a default. A written default is what keeps the set small.

Data Flow

A file to matter and body
1 The divide is found
↓
2 The matter is read as names and values
↓
3 The required set is checked
↓
4 The body is kept as text
Why this works
Why the required set is small

A small set is a set a writer can remember. Everything else has a default, and a default is written.

The one name that must never be free text

The date. A date in free text is a date that cannot be sorted, and sorted is what a list needs.

Examples

The matter is separate from the body

A line divides them. A divide is a rule, and a rule is what makes the matter parseable.

The matter has a required set

A missing name is refused. The refusal names the file, and the file is the place to fix.

The body is text, not code

Text is never run. Never run is the reason a page cannot break a build.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← What a generator is for
Previous Lesson
What a generator is for
Next Lesson
Reading a folder as a contract
Reading a folder as a contract →