Skip to content

Commit 0c617c5

Browse files
committed
Include navigation building blocks
1 parent 9a9f20b commit 0c617c5

File tree

4 files changed

+438
-78
lines changed

4 files changed

+438
-78
lines changed

docs/_docset.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ toc:
5757
- file: link-catalog.md
5858
- file: outbound-crosslinks.md
5959
- file: inbound-crosslinks.md
60+
- file: documentation-set-navigation.md
61+
- file: global-navigation.md
6062
- folder: configure
6163
children:
6264
- file: index.md
Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
---
2+
navigation_title: Documentation Set Navigation
3+
---
4+
5+
# Documentation Set Navigation
6+
7+
**Documentation set navigation** defines how files within a single documentation set are organized and structured. Each documentation set is responsible for its own internal navigation hierarchy.
8+
9+
## Purpose
10+
11+
Documentation set navigation allows repository maintainers to:
12+
13+
* **Organize content** - Define the logical structure of their documentation
14+
* **Control hierarchy** - Determine which pages are nested under others
15+
* **Create sections** - Group related content together
16+
* **Maintain autonomy** - Structure documentation independently of other repositories
17+
18+
## Basic structure
19+
20+
Navigation is defined in the `toc` (table of contents) section of the `docset.yml` file:
21+
22+
```yaml
23+
toc:
24+
- file: index.md
25+
- folder: contribute
26+
children:
27+
- file: index.md
28+
- file: locally.md
29+
children:
30+
- file: page.md
31+
```
32+
33+
## TOC node types
34+
35+
The `toc` section supports several node types:
36+
37+
### File nodes
38+
39+
Reference a single markdown file:
40+
41+
```yaml
42+
- file: getting-started.md
43+
```
44+
45+
Files can also have nested children:
46+
47+
```yaml
48+
- file: locally.md
49+
children:
50+
- file: page.md
51+
```
52+
53+
### Folder nodes
54+
55+
Group related files together:
56+
57+
```yaml
58+
- folder: configuration
59+
children:
60+
- file: index.md
61+
- file: basic.md
62+
```
63+
64+
`children` is optional for `folder` nodes. This will include all files in the folder.
65+
This is especially useful during development when you are unsure how to structure your documentation.
66+
67+
Once `children` is defined, it must reference all `.md` files in the folder. The build will fail if
68+
it detects any dangling documentation files.
69+
70+
### Hidden files
71+
72+
Hide pages from navigation while keeping them accessible:
73+
74+
```yaml
75+
- hidden: deprecated-page.md
76+
```
77+
78+
### Named TOC sections
79+
80+
For larger documentation sets, create named TOC sections that can be referenced in [global navigation](global-navigation.md):
81+
82+
```yaml
83+
toc:
84+
- file: index.md
85+
- toc: development
86+
```
87+
88+
This will include the `toc` section defined in `development/toc.yml`:`
89+
90+
## Dedicated toc.yml files
91+
92+
When a `toc` section becomes too unwieldy, folders can define a dedicated `toc.yml` file to organize their files and link them in their parent `toc.yml` or `docset.yml` file.
93+
94+
### Example with nested TOC
95+
96+
In your `docset.yml`:
97+
98+
```yaml
99+
toc:
100+
- file: index.md
101+
- folder: contribute
102+
children:
103+
- file: index.md
104+
- file: locally.md
105+
children:
106+
- file: page.md
107+
- toc: development
108+
```
109+
110+
Then create `development/toc.yml`:
111+
112+
```yaml
113+
toc:
114+
- file: index.md
115+
- toc: link-validation
116+
```
117+
118+
:::{note}
119+
The folder name `development` is not repeated in the `toc.yml` file. This allows for easier renames of the folder itself.
120+
:::
121+
122+
### Benefits of separate toc.yml files
123+
124+
* **Modularity** - Each section can be maintained independently
125+
* **Cleaner docset.yml** - Keep the main file focused and readable
126+
* **Easier refactoring** - Rename folders without updating TOC references
127+
* **Team ownership** - Different teams can manage different TOC sections
128+
129+
## File paths
130+
131+
All file paths in the `toc` section are relative to the documentation set root (where `docset.yml` is located):
132+
133+
```yaml
134+
toc:
135+
- file: index.md # docs/index.md
136+
- folder: api
137+
children:
138+
- file: index.md # docs/api/index.md
139+
- file: authentication.md # docs/api/authentication.md
140+
```
141+
142+
## Navigation metadata
143+
144+
You can customize how items appear in the navigation:
145+
146+
### Custom titles
147+
148+
The navigation title defaults to a markdown's page first `h1` heading.
149+
150+
To present the file differently in the navigation, add a `navigation_title` metadata field.
151+
152+
```markdown
153+
---
154+
title: Getting Started with the Documentation Builder
155+
navigation_title: Quick Start
156+
---
157+
```
158+
159+
There is no way to set `title` in the `docset.yml` file. This is by design to keep a page's data
160+
contained in its file.
161+
162+
## Relationship to global navigation
163+
164+
When building [assembled documentation](assembled-documentation.md), the documentation set navigation becomes a component of the [global navigation](global-navigation.md):
165+
166+
* **Documentation set navigation** defines the structure **within** a repository
167+
* **Global navigation** defines **how repositories are organized** relative to each other
168+
169+
Named `toc` sections in `docset.yml` can be referenced and reorganized in the global `navigation.yml` file without affecting the documentation set's internal structure.
170+
171+
## Best practices
172+
173+
### Keep it organized
174+
175+
* Group related content in folders
176+
* Use descriptive folder and file names
177+
* Maintain a logical hierarchy
178+
179+
The folder names and hierarchy are reflected directly in the URL structure.
180+
181+
### Use index files
182+
183+
Always include an `index.md` in folders:
184+
185+
```yaml
186+
- folder: api
187+
children:
188+
- file: index.md # Overview of API documentation
189+
- file: endpoints.md
190+
- file: authentication.md
191+
```
192+
193+
### Limit nesting depth
194+
195+
Avoid deeply nested structures (more than three to four levels) to maintain navigation clarity.
196+
197+
### Use toc.yml for large sections
198+
199+
When a section contains many files or becomes complex, extract it to a dedicated `toc.yml`:
200+
201+
```
202+
docs/
203+
├── docset.yml
204+
├── index.md
205+
└── development/
206+
├── toc.yml # Define development section structure here
207+
├── index.md
208+
└── link-validation/
209+
└── toc.yml # Nested TOC section
210+
```
211+
212+
### Name TOC sections meaningfully
213+
214+
Use clear, descriptive names for TOC sections:
215+
216+
**Good:**
217+
```yaml
218+
- toc: api-reference
219+
- toc: getting-started
220+
- toc: troubleshooting
221+
```
222+
223+
**Bad:**
224+
```yaml
225+
- toc: section1
226+
- toc: misc
227+
- toc: other
228+
```
229+
230+
These names will end up in the URL structure of the published documentation
231+
232+
## Related concepts
233+
234+
* [Global Navigation](global-navigation.md) - How documentation sets are organized in assembled documentation
235+
* [Content Set Configuration](../configure/content-set/index.md) - Complete `docset.yml` reference
236+
* [Navigation Configuration](../configure/content-set/navigation.md) - Detailed navigation options

0 commit comments

Comments
 (0)