Skip to main content

Sphinx Extension adding support for custom favicons

Project description

Sphinx Favicon

License: MIT Black badge PyPI PyPI - Python Version GitHub Workflow Status Read the Docs (version)

Note: Updating from Version 0.2 to Version 1.0

Between v0.2 and v1.0, the module name of the extension changed to better conform with Python standards. Please update the name used in the extension list of your conf.py from sphinx-favicon to sphinx_favicon!

A Sphinx extension to add custom favicons

With Sphinx Favicon, you can add custom favicons to your Sphinx html documentation quickly and easily.

You can define favicons directly in your conf.py, with different rel attributes such as "icon" or "apple-touch-icon" and any favicon size.

The Sphinx Favicon extension gives you more flexibility than the standard favicon.ico supported by Sphinx. It provides a quick and easy way to add the most important favicon formats for different browsers and devices.

Installation

Use pip to install Sphinx Favicon in your environment:

pip install sphinx-favicon

Usage

After installing sphinx-favicon, add it to your conf.py extension list:

extensions = ["sphinx_favicon"]

Then configure the favicon links using the favicons parameter (html_static_path is mandatory if you use relative path):

html_static_path = ["_static"]

favicons = [
    {"href": "icon.svg"},  # => use `_static/icon.svg`
    {"href": "https://secure.example.com/favicon/favicon-16x16.png"},
    {"href": "https://secure.example.com/favicon/favicon-32x32.png"},
    {
        "rel": "apple-touch-icon",
        "href": "https://secure.example.com/favicon/apple-touch-icon-180x180.png",
    },
]

Based on this configuration, Sphinx will include the following favicon information in the HTML <head> element:

<link rel="icon" href="_static/icon.svg" type="image/svg+xml">
<link rel="icon" href="https://secure.example.com/favicon/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="icon" href="https://secure.example.com/favicon/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="apple-touch-icon" href="https://secure.example.com/favicon/apple-touch-icon-180x180.png" sizes="180x180" type="image/png">

For more details and more advanced usage, please see the documentation.

Contribution

Contributions of any kind are welcome. Please see the contribution section of our documentation for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx-favicon-1.0.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

sphinx_favicon-1.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file sphinx-favicon-1.0.1.tar.gz.

File metadata

  • Download URL: sphinx-favicon-1.0.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for sphinx-favicon-1.0.1.tar.gz
Algorithm Hash digest
SHA256 df796de32125609c1b4a8964db74270ebf4502089c27cd53f542354dc0b57e8e
MD5 211b14a52b5a6dfeaa1669af2825c27d
BLAKE2b-256 b1253c78b785c3ea991597c310ac6bdc7949c2a7549e031dbb22db4ce8d1b99b

See more details on using hashes here.

File details

Details for the file sphinx_favicon-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_favicon-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c93d6b634cb4c9687ceab67a8526f05d3b02679df94e273e51a43282e6b034c
MD5 6f6833080660405d65ba390b687e4cf6
BLAKE2b-256 92c2152bd6c211b847e525d2c7004fd98e3ac5baeace192716da8cd9c9ec2427

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page