Skip to content

Allow per-page templates.  #17

@carltongibson

Description

@carltongibson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions