31

I'm already using a custom css to override some of the styles of the theme using

def setup(app):
    app.add_css_file('custom.css')

This works fine. What other app. functions are available? I can't find any documentation.

I'm looking for the function to override the favicon.

Paul Meems
  • 3,002
  • 4
  • 35
  • 66
  • It's in your theme's template. You can override theme files. – Steve Piercy Feb 11 '19 at 22:06
  • Thanks @StevePiercy for your reply. Can you show me how I can override theme files? Or do I need to download the full theme and make a custom version? I would like to avoid that. – Paul Meems Feb 12 '19 at 08:51
  • It depends on the theme. For both included and installable themes, [SO has many posts](https://stackoverflow.com/search?q=%5Bpython-sphinx%5D+custom+theme) or consult [Sphinx docs](https://www.sphinx-doc.org/en/master/theming.html). – Steve Piercy Feb 12 '19 at 09:03

2 Answers2

36

Thanks to @StevePiercy I found this documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_favicon

conf.py

html_favicon = 'favicon.ico'

I put favicon.ico in my source folder, next to my .rst-files and it is working as expected: https://global-coffee-data-standard.readthedocs.io/en/latest/index.html

Kermit
  • 4,922
  • 4
  • 42
  • 74
Paul Meems
  • 3,002
  • 4
  • 35
  • 66
1

In addition to Sphinx's native favicon support (https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_favicon), you can also use this Sphinx extension I created: https://pypi.org/project/sphinx-favicon/ With this extension, you can add multiple favicons, including apple-touch-icon and icons of different sizes. You can also use PNG or other supported file types.

tcmetzger
  • 86
  • 4