didyoumean.py
DidYouMean Plugin for Markata
Automatically generates redirect pages for URLs that may be mistyped by users.
Installation
hooks = [ "markata.plugins.didyoumean", ]
Configuration
[markata.didyoumean] output_dir = "markout" # Directory where HTML files will be saved didyoumean_filter = "True" # A filter expression to determine which pages should be included in suggestions search_hotkey = "/" # Hotkey to focus the search input. Set to None to disable. Default is "/"
Usage
This plugin will generate HTML redirect pages for missing URLs that forward users to the most relevant existing page, or present a list of suggested pages when ambiguity exists.
Function
render_template function
Render a template with the given context.
render_template source
def render_template(markata: "Markata", template_name: str, **context) -> str: """Render a template with the given context.""" template = markata.config.jinja_env.get_template(template_name) return template.render(markata=markata, body="", config=markata.config, **context)