Give the content a structure
2 Give the content a structure
OINK does not keep a second navigation database for an ordinary site. The content tree is the sidebar tree, and the same order drives the pager and the Book contents. A reader should not encounter three different answers to “what comes next?”
Start from the reader’s questions
Name the top-level sections after tasks or subjects the reader recognizes. A small engineering site usually needs a start section, a reference, operations guidance, and a record of change. Add a directory only when it gives several pages a useful shared context.
Keep the Starter from Chapter 1, including its existing examples. In this chapter, add one English page and its Chinese peer under the existing Docs section. French can remain enabled; this exercise adds only the two peers below.
Build the tree
Files used by this exercise; other Starter files stay in place
- content/
- docs/
- _index.mdexisting section root
- _index.zh.mdexisting translated root
- preview-check.mdadd this page
- preview-check.zh.mdadd its translation
- docs/
Create these two files with the complete contents below. The section roots already exist; do not replace them.
A translation sits beside its English source with the .zh.md suffix. These
pages have no images or downloads, so individual Markdown files are enough;
use a page bundle when a page owns those resources.
Keep order explicit
The existing sections use spaced weights. The new page uses 25 so it can
fit between neighbors without renumbering them. Keep the same weight on both
translations. For a new tree, multiples of ten leave similar room to grow:
| Item | Weight | Why it comes here |
|---|---|---|
| Get started | 10 | Establish the working baseline |
| Write content | 20 | Build on a running site |
| Customize | 30 | Change presentation after structure |
| Operate | 40 | Validate and publish the result |
Make stable addresses
Write an explicit ID on every heading another page may cite. The English and Chinese pages use the same ID even though their visible headings differ. This keeps links, the table of contents, and whole-book print aligned across both languages.
With hugo server running, open /docs/preview-check/ and
/zh/docs/preview-check/. Both should appear in their Docs sidebar, and the
language switch should open the matching peer. The heading in both pages
should have #check-preview. Keep these files for Chapter 3.
For the complete rules, see Writing pages and Organizing content.