- Documentation
- Customize your site
- Navigation
Navigation
Shape your sidebar and header with tabs, groups, anchors, versions and languages in docs.json.
Your navigation lives in the navigation key of docs.json. A page is on your site only if it’s listed there. To
reorder pages, drag them in the editor’s page tree. To add tabs, groups, versions or languages, edit docs.json.
Tabs and groups
Section titled “Tabs and groups”A tab is a row in the header. A group is a numbered chapter in the sidebar. Groups hold pages, and can hold other groups.
{ "navigation": { "tabs": [ { "tab": "Guides", "groups": [ { "group": "Get started", "icon": "rocket", "expanded": true, "pages": [ "introduction", "quickstart", { "group": "Install", "pages": ["install/macos", "install/linux"] } ] } ] }, { "tab": "Blog", "href": "https://github.com/your-org/your-repo/discussions" } ] }}- A page is its file path from the docs folder, with no extension. A page that doesn’t exist is left out, with a warning.
- A group with
expanded: truestarts open. The group holding the current page is always open. - A tab with an
hrefand no pages is a link, shown beside the other tabs. - A tab with no
groupscan listpagesdirectly. - With no tabs at all, put
groupsorpagesstraight undernavigation.
Chapter numbers come from the theme. See Theme and fonts.
Anchors
Section titled “Anchors”An anchor is a link with an icon at the top of the sidebar, such as a changelog or a community. Give an anchor groups
or pages instead of an href, and it becomes a tab.
{ "navigation": { "anchors": [{ "anchor": "Community", "icon": "users", "href": "https://github.com/your-org/your-repo/discussions" }], "global": { "anchors": [{ "anchor": "Support", "icon": "life-buoy", "href": "https://github.com/your-org/your-repo/issues" }] }, "groups": [{ "group": "Start", "pages": ["introduction"] }] }}global.anchors appear on every version and language. The others belong to the one they’re in.
Versions and languages
Section titled “Versions and languages”List versions or languages at the top of navigation, each with its own tabs, groups or pages. Readers get a switcher
when there’s more than one.
{ "navigation": { "versions": [ { "version": "v2", "default": true, "groups": [{ "group": "Start", "pages": ["v2/introduction"] }] }, { "version": "v1", "groups": [{ "group": "Start", "pages": ["v1/introduction"] }] } ] }}Languages work the same way, with a language code such as en or es in place of version. You can nest languages
and versions in each other.
- The version or language marked
default: truecomes first, or the first listed if none is marked. - The switcher goes to the same page in the other version or language when it has one, and to its first page when it doesn’t.
- Each version and language is its own tree, so write its pages as separate files, such as
v1/introductionandv2/introduction. - Inside a tab, only the default version or language is built, with a warning that the others aren’t.
What Specly warns about
Section titled “What Specly warns about”Specly builds what it can and warns about the rest:
| You wrote | What happens |
|---|---|
dropdowns, products or menu |
They show as tabs, with a warning. |
An entry with $ref, which splits navigation into other files |
It’s left out, with a warning. |
| A page that doesn’t exist | It’s left out, with a warning. |
| Navigation with no page that exists | The build stops. |
In the dashboard
Section titled “In the dashboard”Navigation › Tabs and groups shows your tabs, the groups in each and how many pages they hold, as docs.json has
them, including moves you haven’t published. It’s read-only. Pages move in the editor’s page tree, and Open docs.json
opens the file itself. See Writing in the editor.
Navigation › Languages appears when docs.json lists more than one language. It compares each with the default
one, and counts pages with no translation yet and translations older than the page they translate. Editors and admins
can choose Translate with the agent on a language, and the docs agent opens one pull request with up to 20 missing or
out-of-date pages for you to review.
For every key, see the docs.json reference.