Navigation
Last update: a month ago by Mateusz FilipowiczReading time: 2 min
Understanding navigation is key to setting up you content properly, especially sidebar and content links.
First, lets understand how page links are built from content structure.
Page links
- root
content
directory represents a root of your app index.md
(orindex.mdx
) must exist incontent
directory and it will be entrypoint (/
) of your app.- every link is derived from file name, e.g. file
myPage
incontent
directory creates link/myPage
, so just extension is stripped - link to the page is also derived from the relative path from
content
, thus each directory incontent
is a part of page path, e.g. filemyPage
incontent/mygroup
directory will have link/mygroup/myPage
- directories can be organized in groups (making a sidebar group) or subgroups (groups which are expandable and have nested pages).
- to create a subgroup with nested pages, you need to
- create directory with nested pages, e.g.
nested_group
- in same directory as just created dir, create file
nested_group.md
which will be a "parent" of the nested group
- create directory with nested pages, e.g.
- to create group, you need to:
Let's follow this example of project file and directory structure:
projectβββββcontentβββ index.mdβββ page1.md|ββ page2.mdβββββgroup1β βββ my_page1.mdβ βββ myPage2.mdβ ββββmyPage2β βββ my_subpage.mdβββββpage2βββ my_page1.mdβββ myPage2.mdββββmyPage2
Structure defined as above, will generate following page paths (links).
index.md => /page1.md => /page1page2.md => /page2page2/subpage.md => /page2/subpagegroup1/my_page1.md => /group1/my_page1group1/myPage2.md => /group1/myPage2group1/myPage2/my_subpage.md => /group1/myPage2/my_subpage