Setting the homepage
Setting the Homepage¶
If you want an MkPage to become your Homepage, set is_homepage
to True in the MkPage constructor for the page you want to become your homepage.
sub_nav = root_nav.add_nav("My child nav")
# first we create an MkPage with is_homepage set to True
my_homepage = mk.MkPage("My first Homepage", is_homepage=True)
# Then we add it to any given MkNav.
sub_nav += my_homepage
my_homepage
is now both the homepage and a child page from sub_nav
.
If decorators are used for routing, is_homepage
can be passed as decorator keyword argument
with the same effect.
nav = root_nav.get_nav("My child nav")
@nav.route.page("My first Homepage", is_homepage=True)
def _(page: mk.MkPage):
page += ...
...
Setting Index pages¶
Index pages is a more general term and can also refer to pages which could be described as a "Sub-Homepages". The homepage itself is also an index page.
For pages with a hierarchical site navigation, you can usually reach the index pages by clicking the section label in the site navigation menu.
Info
MkDocs does not support index pages "out-of-the box". You either need the plugin mkdocs-section-index or a theme which supports them natively.
To create an index page for a section, you can use the is_index
keyword argument [MkNav.add_page][mknodes.MkNav.add_page]:
Page info
Code for this page
Resources
Resources(css=[],
markdown_extensions={'attr_list': {},
'md_in_html': {},
'pymdownx.emoji': {'emoji_generator': <function to_svg at 0x7fd7a6931800>,
'emoji_index': <function twemoji at 0x7fd7a69316c0>},
'pymdownx.magiclink': {'repo': 'mknodes',
'repo_url_shorthand': True,
'user': 'phil65'}},
plugins=[],
js=[],
assets=[],
packages=[])