subroute.py

None

pre_render function

Sets the article slug if one is not already set in the frontmatter.

pre_render source
def pre_render(markata: "Markata") -> None:
    """
    Sets the article slug if one is not already set in the frontmatter.
    """
    subroute = markata.config.get("subroute", "")
    for article in markata.iter_articles(description="creating slugs"):
        slug = Path(article.get("slug", Path(article["path"]).stem))
        article["slug"] = slug.parent / Path(subroute) / slug.stem