banner

Configuration

Themes

Most of the html themes available in Sphinx are based on the ‘basic’ theme. This means they also inherit the configuration options that are available for the ‘basic’ theme. Example: you can configure the ‘default’ theme with the ‘nosidebar’ option. The Sphinx documentation for the ‘default’ theme does not mention this configuration option!

Image / logo in header

The logo option available in the conf.py file puts a logo in the sidebar. If you disable the sidebar you will loose your logo. In order to show an image in the header of your website you have to modify the layout.html template file.

Look at how the Sphinx website itself does it:

try creating a file layout.html in _templates directory in your
project's directory:

$ cat _templates/layout.html
{% extends "!layout.html" %}

{% block header %}
<img src="{{ pathto("_static/sphinx.png", 1) }}" alt="Sphinx logo" />
{% endblock %}
$

This should do the job, given that you have this line in your
conf.py uncommented:

templates_path = ['_templates']

Via http://groups.google.com/group/sphinx-dev/browse_thread/thread/37c22abca1304cd8/410b6239f77a6a3f?lnk=gst&q=logo#410b6239f77a6a3f

Show rest source

You can configure your Sphinx site to show a link to the content rest source on every page. This link is always placed in the sidebar. If you don’t want to use the sidebar you have to modify the layout.html template file and insert a placeholder for the show source link at another spot. For example in the page footer. Take a look at this example:

file: source/_template/layout.html

{% extends "!layout.html" %}
{% block footer %}
{# No '{{ super() }}' in this block because I override all default footer content with the following #}
<div class="footer">
        <a href="{{ pathto("about-this-site") }}">Built with Sphinx</a> |
{%- if show_source and has_source and sourcename %}
     <a href="{{ pathto('_sources/' + sourcename, true)|e }}"
        rel="nofollow">{{ _('Show Source') }}</a>
{%- endif %}
| &copy; <a href="{{ pathto("about-this-site.html#copyright-information", 1) }}">Copyright 2010</a>, Jeroen Leijen
</div>
{% endblock %}

{% block header %}
<img src="{{ pathto("_static/banner.png", 1) }}" alt="banner" />
{{ super() }}
{% endblock %}

Published:Fri Jun 25 2010