Debian Codegraph @

docs/source/quickstart.rst

raw
1 Quickstart
2 ==========
3
4 This section contains basic information about **Sphinx Favicon** to get you started.
5
6 Installation
7 ------------
8
9 Use ``pip`` to install **Sphinx Favicon** in your environment:
10
11 .. code-block:: console
12
13 pip install sphinx-favicon
14
15 Extension setup
16 ---------------
17
18 Enable the extension
19 ^^^^^^^^^^^^^^^^^^^^
20
21 After installing **Sphinx Favicon**, add ``sphinx_favicon`` to the list of extensions
22 in your ``conf.py`` file:
23
24 .. code-block:: python
25
26 extensions = [
27 #[...]
28 "sphinx_favicon",
29 ]
30
31 Check static directory configuration
32 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33
34 In case you want to use favicons from files in your static directory, make sure that
35 the `html_static_path <https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path>`_
36 in your ``conf.py`` is configured correctly. For example:
37
38 .. code-block:: python
39
40 html_static_path = ["_static"]
41
42 Favicon configuration
43 ---------------------
44
45 Add basic favicons
46 ^^^^^^^^^^^^^^^^^^
47
48 After adding ``sphinx_favicon`` to your list of extensions, you can now use the
49 ``favicons`` variable in ``conf.py`` to define favicons.
50
51 There are many ways to define favicons, with varying degrees of complexity.
52 The simplest way to add favicons is to define a list of favicon file names or URLs.
53
54 For example:
55
56 .. code-block:: python
57
58 favicons = [
59 "favicon-16x16.png",
60 "favicon-32x32.png",
61 "icon.svg",
62 ]
63
64 **Sphinx Favicon** automatically determines the relevant attributes for each favicon and
65 adjusts paths for static files where necessary.
66
67 Based on this configuration, **Sphinx Favicon** adds the following ``<link>`` tags in
68 the HTML ``<head>`` for each page in your Sphinx-generated HTML documentation:
69
70 .. code-block:: html
71
72 <link href="_static/favicon-16x16.png" sizes="16x16" rel="icon" type="image/png">
73 <link href="_static/favicon-32x32.png" sizes="32x32" rel="icon" type="image/png">
74 <link href="_static/icon.ico" rel="icon" type="image/x-icon">
75
76 You can mix file names (relative to your ``html_static_path``) and URLs in this list.
77 For example:
78
79 .. code-block:: python
80
81 favicons = [
82 "https://picsum.photos/16/16",
83 "https://picsum.photos/32/32",
84 ]
85
86 This will add the following ``<link>`` tags:
87
88 .. code-block:: html
89
90 <link href="https://picsum.photos/16/16" sizes="16x16" rel="icon" type="image/png">
91 <link href="https://picsum.photos/32/32" sizes="32x32" rel="icon" type="image/png">
92
93 Advanced usage
94 --------------
95
96 This chapter only covers basic setup. For more advanced usage, see the
97 :ref:`following chapter <configuration>`!