0

I would like to include a link to our publishing notes in the footer of Spinx html outout, next to the Copyright notice.

  • I tried to include a link in the copyright notice in conf.py. However, that is not rendered as expected. I tried several formats for the link and none worked so far.

    copyright = '2023, Foo. Also see `PUBLISHING NOTES <https://www.foo.de/en/publishing-notes.html>`_'
    

enter image description here

  • There does not seem to be an extra Sphinx option for the publishing notes.

=> What is the recommended way to include publishing notes in the (html output of) Sphinx documentation?

=> Or asked in a more general way: how can I adapt the html footer that contains the copyright notice (and that is shown below each content page)?

Edit:

I also tried

html_theme_options = {
    'footer': '<a href="https://www.foo.de/en/publishing-notes.html">PUBLISHING NOTES</a>'
}

without luck.

Related:

https://github.com/readthedocs/sphinx_rtd_theme/issues/1490

mzjn
  • 48,958
  • 13
  • 128
  • 248
Stefan
  • 10,010
  • 7
  • 61
  • 117

1 Answers1

1

a) With sphinx_rtd_theme

  • Create a file _templates/footer.html inside the sphinx source folder with following content:

    {% extends "!footer.html" %}
    {% block extrafooter %}
        <p><a href="https://www.foo.de/en/publishing-notes.html">PUBLISHING NOTES</a></p>
        {{ super() }}
    {% endblock %}
    
  • Reference the theme and _templates directory in conf.py:

    html_theme = 'sphinx_rtd_theme'
    templates_path = ['_templates']
    

enter image description here

Also see https://github.com/readthedocs/sphinx_rtd_theme/issues/349

b) Without sphinx_rtd_theme

See following related SO question on how to override the default layout:

How can I add a custom footer to Sphinx documentation?

_templates/layout.html:

{% extends '!layout.html' %}

{% block footer %}
        <!-- your html code here -->
{% endblock %}

That layout will probably not be applied if you specify an explicit theme. With an explicit theme use some theme specific options like shown in a)

Stefan
  • 10,010
  • 7
  • 61
  • 117