Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Metadata

##Description

Every MkPage as well as every MkNav can carry metadata. Page metadata inherits from Nav metadata, similarly as the MkDocs-Material meta plugin.

Metadata can be set either via the MkPage constructor, via the MkNav.route.page decorator. Also, some methods like MkNav.parse.folder take metadata keyword arguments in order to set it for all parsed pages.

Examples

Via decorators:

@nav.route.page("My page", icon="material/code-json", status="new")
def _(page: mk.MkPage):
    ...

Via constructor:

page = MkPage("My page", icon="material/code-json", status="new")

Metadata fields

class Metadata

The Metadata class is a subclassed Python dictionary.

It is enhanced with properties for common metadata fields in order to get proper type hints. Since this object is a dict subclass, you can of course also add any non-documented stuff to the Metadata.

Page info
Code for this page

mknodes.manual.page_section._

@nav.route.page(
    "Metadata",
    status="deprecated",
    search_boost=2.0,
    subtitle="Subtitle",
    description="Description",
)
def _(page: mk.MkPage) -> None:
    page += mk.MkTemplate("pages/page_metadata.jinja")

Resources
Resources(css=[],
          markdown_extensions={},
          plugins=[Plugin('mkdocstrings')],
          js=[],
          assets=[],
          packages=[])
Metadata
created:
  source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/page_section.py
  source_function: _
  source_line_no: 43
description: Description
search:
  boost: 2.0
status: deprecated
subtitle: Subtitle
title: Metadata