django-sphinx-view icon indicating copy to clipboard operation
django-sphinx-view copied to clipboard

Allow per-page templates.

Open carltongibson opened this issue 2 years ago • 0 comments

Follow-up to #12/#15 — adding global TOC.

By setting file-wide metadata, before any other markup:

:page_template: sphinx_view/no-globaltoc.html

… it's possibly to switch the template used to render each page, for example to not show the global TOC, on the index page, where it's already defined.

assert doc["meta"]["page_template"] == "sphinx_view/no-globaltoc.html"
  1. Store the result of get_doc_json() on self. (As a @property? 🤔)
  2. Re-use that in get_template_names() to see if doc["meta"]["page_template"] is set.
  • Use that if so.
  • Otherwise, self.template_name, as usual.

carltongibson avatar Feb 28 '22 15:02 carltongibson