Skip to content

Page

Page

The base object used to make web pages. Pages can be rendered directly from a template or generated from a file.

Note

Not all attributes are defined by default (those that are marked optional) but will be checked for in other areas of the code.

When you create a page, you can specify variables that will be passed into rendering template.

content_path: Path | str | None = None class-attribute

The path to the file that will be used to generate the page.

Note

This overrides the markdown attribute.

extension: str = '.html' class-attribute

Extension to use for the rendered page output.

markdown: str | None = None class-attribute

This is base markdown that will be used to render the page.

Warning

This will be overwritten if a content_path is provided.

markdown_extras: list[str] = ['fenced-code-blocks', 'footnotes'] class-attribute

Plugins that will be used with the markdown parser (default parser is Markdown2).

You can see a list of all the plugins here.

The default plugins fenced-code-blocks and footnotes provide a way to add code blocks and footnotes to your markdown.

content() property

html = rendered HTML (not marked up). Is None if content == None This is referred to as content because it is intended to be applied in the jinja template as {{content}}. When referring to the raw content in the Page object use markdown.

render(*, engine=None, **kwargs)

Build the page based on content instructions

url() property

The first route and the slug of the page.