Override html page template for a specific sphinx document

前端 未结 2 606
情深已故
情深已故 2021-01-11 10:39

I\'m implementing a documentation using Sphinx (https://github.com/fridge-project/dbal-docs) & would like to override the html page of a specific document. My interest i

2条回答
  •  再見小時候
    2021-01-11 11:09

    One should be able to use a variable to define the template to extend from.

    In that way it might be less of a 'hack'. And you have full control about the generated output(not only the body block).

    layout.html:

    {% extends meta.page_template|default('basic/page.html') %}
    

    And in your index.rst you use then page-level metadata:

    index.rst:

    :page_template: custom/index.html
    
    

提交回复
热议问题