[Info] Change template for index.html
Hello,
I would like to change the template only for the index.html. There is a way to do that ?
Thank you in advance !
Not sure offhand -- that's more of a "sphinx" general thing than a "sphinx bootstrap theme" thing. Perhaps the official sphinx docs can help you?
Thank you for your help !
This can be be done by adding a layout.html file to your _templates directory that extends the bootstrap file.
I was able to modify the template, only for the index.html, by adding the following
{% if pagename == "index" %}
<your HTML goes here>
{% endif %}
Here is all my code. My goal was to add a banner image and title so I created variable in conf.py using the html_context dictionary
{% extends "!layout.html" %}
{%- block content %}
{{ navBar() }}
{% if pagename == "index" and show_banner %}
<div class="container-fluid text-center">
<h1>{{ banner_title }}</h1>
<img src="{{ pathto('_static/' + banner_image, 1) }}">
</div>
{% endif %}
<div class="container">
<div class="row">
{%- block sidebar1 %}{{ bsidebar() }}{% endblock %}
<div class="{{ bs_span_prefix }}{{ bs_content_width }} content">
{% block body %}{% endblock %}
</div>
{% block sidebar2 %} {# possible location for sidebar #} {% endblock %}
</div>
</div>
{%- endblock %}
Thank you!