Basic

Links between pages as a graph

A page links another page. The link is a name, and a name that has no page is the whole bug of a site build.

What you will see

2. The print is the links of every page.

About 1 min of reading

Try It

Check a link against a set

1

Write the built set

printf '/a/\n/b/\n/c/\n' > /tmp/b.txt; wc -l < /tmp/b.txt

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

What it prints
3. Three pages is the set known at build.
2

Attempt a missing link

printf '/d/\n' | grep -c -f -x /tmp/b.txt /dev/stdin | awk '{print ($1==0) ? "refuse page and link" : "ok"}'

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

What it prints
refuse page and link. Two names is the whole answer.
3

Print the graph

printf 'a -> b\na -> c\n' > /tmp/g.txt; wc -l < /tmp/g.txt

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

What it prints
2. The print is the links of every page.

Data Flow

A page to checked links
1 The links are collected per page
↓
2 Each is checked against the built set
↓
3 A miss refuses with page and link
↓
4 The graph is printed
Why this works
The one link type that is not checked

An outside address. Outside is not in the set, and not in the set is a different claim.

When you have a choice

Why the check is at build rather than at serve

The set is complete at build. Complete at build is why the check costs nothing at serve.

Examples

The link is checked against the built set

The set is known at build. Checking against a known set is checking without a crawl.

A broken link is a refusal

The refusal names the page and the link. Two names is the whole answer.

The graph is printed

The print is the links of every page. A printed graph is a graph that a reader can argue with.

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.

← Filling with escaping
Previous Lesson
Filling with escaping
Next Lesson
The build answers with a report
The build answers with a report →