Skip to content

Commit 13c3c10

Browse files
committed
setup/navigation:fix add missing info on defining nav
1 parent 6b53e8b commit 13c3c10

1 file changed

Lines changed: 115 additions & 0 deletions

File tree

docs/setup/navigation.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,121 @@ Additional navigation can be configured [in the footer].
2424

2525
## Configuration
2626

27+
By default, Zensical creates the navigation sidebar on the basis of the folder
28+
structure and content of the Markdown pages. Likewise, it uses a default layout
29+
that can be overridden using various feature flags described on this page.
30+
31+
### Explicit navigation
32+
33+
If you want to exercise more control over the structure of your navigation, you
34+
can create an explicit definition of the navigation structure in your
35+
configuration file. In the simplest case, you simply list the paths to your
36+
content files, leaving it to Zensical to extract a title for each of them from
37+
the content itself. The paths need to be relative to the [`docs_dir`][docs_dir].
38+
39+
[docs_dir]: basics.md#docs_dir
40+
41+
=== "`zensical.toml`"
42+
43+
``` toml
44+
[project]
45+
nav = [
46+
"index.md",
47+
"about.md"
48+
]
49+
```
50+
51+
=== "`mkdocs.yml`"
52+
53+
``` yaml
54+
nav:
55+
- index.md
56+
- about.md
57+
```
58+
59+
Instead of letting Zensical figure out the title to use for the navigation entry
60+
for a page, you can also explicitly specify a title:
61+
62+
=== "`zensical.toml`"
63+
64+
``` toml
65+
[project]
66+
nav = [
67+
{"Home" = "index.md"},
68+
{"About" = "about.md"}
69+
]
70+
```
71+
72+
=== "`mkdocs.yml`"
73+
74+
``` yaml
75+
nav:
76+
- Home: index.md
77+
- About: about.md
78+
```
79+
80+
!!! tip "Navigation structure in Zensical vs. Mkdocs"
81+
Users of Material for MkDocs or other MkDocs themes may notice that the
82+
structure of navigation entries in the `zensical.toml` differs from the
83+
structure in the `mkdocs.yml`. This represents a first step towards
84+
realizing a more [modular navigation] system in Zensical.
85+
86+
[modular navigation]: https://zensical.org/about/roadmap/#modular-navigation
87+
88+
#### Navigation sections
89+
90+
You can define navigation sections to create a navigation hierarchy that guides
91+
your users to the information they require.
92+
93+
=== "`zensical.toml`"
94+
95+
``` toml
96+
[project]
97+
nav = [
98+
{"Home" = "index.md"},
99+
{"About" = [
100+
"about/index.md",
101+
"about/vision.md",
102+
"about/team.md"
103+
]}
104+
]
105+
```
106+
107+
=== "`mkdocs.yml`"
108+
109+
``` yaml
110+
nav:
111+
- Home: index.md
112+
- About:
113+
- about/index.md
114+
- about/vision.md
115+
- about/team.md
116+
```
117+
118+
#### External links
119+
120+
Navigation items typically provide a path to a Markdown page. However, any
121+
string that cannot be resolved to a Markdown page is treated as a URL.
122+
123+
=== "`zensical.toml`"
124+
125+
``` toml
126+
[project]
127+
nav = [
128+
{"GitHub Repo" = "https://github.com/zensical/docs"}
129+
]
130+
```
131+
132+
=== "`mkdocs.yml`"
133+
134+
``` yaml
135+
nav:
136+
- GitHub Repo: https://github.com/zensical/docs
137+
```
138+
139+
The "GitHub Repo" navigation entry takes the user to the repository for the
140+
Zensical Documentation.
141+
27142
### Instant navigation
28143

29144
When instant navigation is enabled, clicks on all internal links will be

0 commit comments

Comments
 (0)