-
Notifications
You must be signed in to change notification settings - Fork 341
Change default logo alt text #1472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
a4a6979
e1b9f7b
881847a
71c57b1
36f1fe5
c54c0ac
3430634
4c4c0f0
442e776
3850784
7cbcc32
b75cf0f
a83bca2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -77,41 +77,43 @@ To reference an external website, make sure your link starts with ``http``: | |||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
Customize logo alternative text | ||||||||||||||
------------------------------- | ||||||||||||||
|
||||||||||||||
You may set a custom ``alt text`` for your logo to replace the default ``"logo image"`` generic description. | ||||||||||||||
Adding a descriptive ``alt text`` can help make your documentation more accessible to readers using screen readers or another assistive tech. | ||||||||||||||
Add a logo title | ||||||||||||||
---------------- | ||||||||||||||
|
||||||||||||||
To do so, customize the ``html_theme_options["logo"]["alt_text"]`` configuration option as in the following example: | ||||||||||||||
To add a title in the brand section of your documentation, define a value for ``html_theme_options.logo["text"]``. | ||||||||||||||
This title will appear next to the logo image if set. | ||||||||||||||
|
||||||||||||||
.. code-block:: python | ||||||||||||||
:caption: conf.py | ||||||||||||||
|
||||||||||||||
html_theme_options = { | ||||||||||||||
"logo": { | ||||||||||||||
# Because the logo is also a homepage link, including "home" in the alt text is good practice | ||||||||||||||
"alt_text": "My Project Name - Home", | ||||||||||||||
"text": "My awesome documentation", | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
Add a logo title | ||||||||||||||
---------------- | ||||||||||||||
.. note:: The ``html_title`` field will work as well if no logo images are specified. | ||||||||||||||
|
||||||||||||||
To add a title in the brand section of your documentation, define a value for ``html_theme_options.logo["text"]``. | ||||||||||||||
This title will appear next to the logo image if set. | ||||||||||||||
Customize logo alternative text | ||||||||||||||
gabalafou marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
------------------------------- | ||||||||||||||
|
||||||||||||||
Adding a descriptive ``alt text`` can help make your documentation more accessible to readers using screen readers or other assistive tech. | ||||||||||||||
gabalafou marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
By default, the theme will set ``alt text`` to ``<Your Project Name> - Home`` unless you provide a logo title, in which case the theme sets the ``alt text`` to the empty string. The assumption is that if you provide a logo title, the title is probably doing the work of the alt text. | ||||||||||||||
gabalafou marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
However, if you don't like the default values, you may set a custom ``alt text`` for your logo. | ||||||||||||||
|
||||||||||||||
To do so, customize the ``html_theme_options["logo"]["alt_text"]`` configuration option as in the following example: | ||||||||||||||
|
||||||||||||||
.. code-block:: python | ||||||||||||||
:caption: conf.py | ||||||||||||||
|
||||||||||||||
html_theme_options = { | ||||||||||||||
"logo": { | ||||||||||||||
"text": "My awesome documentation", | ||||||||||||||
# Because the logo is also a homepage link, including "home" in the alt text is good practice | ||||||||||||||
"alt_text": "My Project Name - Home", | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems odd to demo customization by specifying what would happen by default anyway? Here's a realistic made-up example.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. Hmm. This would result in assistive tech representing the link as "PggPy - Home A pretty good geometry package." I think that this section of the docs needs to be rewritten to provide a handful of examples (maybe a couple ones marked good and a couple marked bad). That was something I was planning to do in a follow-up PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does it help if default is "Home - pkgname" instead of "pkgname - Home"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After examining logo alt text on a few sites, such as pac.bz, tink.uk, sarasoueidan.com, and w3.org, I do not think there's a clear consensus on how to do this. So I think, ultimately, what we have is fine. |
||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
.. note:: The ``html_title`` field will work as well if no logo images are specified. | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
Add favicons | ||||||||||||||
============ | ||||||||||||||
|
||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.