diff --git a/doc/internals/rendering.md b/doc/internals/rendering.md index ee76cc8..69a26a8 100644 --- a/doc/internals/rendering.md +++ b/doc/internals/rendering.md @@ -29,7 +29,8 @@ If `use-default-templates` is `false` and the templates are not defined in your { "content": "

...", # The XHTML for the document. "title": "Some Document", # The extracted title of the document. - "crumbs": [("index", "/"), ("some-document", None)] # Breadcrumbs + "crumbs": [("index", "/"), ("some-document", None)], # Breadcrumbs + "path": "some-document" # Root-relative path to document } The `config` variable is also (globally) set to the configuration dictionary for the current wiki. diff --git a/src/markdoc/builder.py b/src/markdoc/builder.py index c646753..4419f7c 100644 --- a/src/markdoc/builder.py +++ b/src/markdoc/builder.py @@ -180,6 +180,7 @@ def render_document(self, path, cache=True): context['content'] = self.render(path) context['title'] = self.title(path) context['crumbs'] = self.crumbs(path) + context['path'] = p.splitext(path)[0] context['make_relative'] = lambda href: make_relative(path, href) template = self.config.template_env.get_template('document.html')