mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
Sphinx 6: Use logo_url instead of logo (#1405)
* Sphinx 6: Use logo_url instead of logo * Handle removal of favicon template context + refactor display of logo and link so it's easier to see what belongs to <4.0 and what is >=4.0 * Adds a favicon to the demo * Import condensed version logic @agjohnson * Update sphinx_rtd_theme/layout.html Co-authored-by: Anthony <aj@ohess.org> Co-authored-by: Anthony <aj@ohess.org>
This commit is contained in:
committed by
GitHub
parent
ce20cfccca
commit
5e80b2bd08
@@ -70,6 +70,7 @@ if not 'READTHEDOCS' in os.environ:
|
||||
|
||||
html_logo = "demo/static/logo-wordmark-light.svg"
|
||||
html_show_sourcelink = True
|
||||
html_favicon = "demo/static/favicon.ico"
|
||||
|
||||
htmlhelp_basename = slug
|
||||
|
||||
|
||||
BIN
docs/demo/static/favicon.ico
Normal file
BIN
docs/demo/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 766 B |
@@ -40,14 +40,14 @@
|
||||
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
|
||||
{%- endfor -%}
|
||||
|
||||
{#- FAVICON #}
|
||||
{%- if favicon %}
|
||||
{%- if sphinx_version_info < (4, 0) -%}
|
||||
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
|
||||
{%- else %}
|
||||
<link rel="shortcut icon" href="{{ favicon_url }}"/>
|
||||
{%- endif %}
|
||||
{%- endif -%}
|
||||
{#- FAVICON
|
||||
favicon_url is the only context var necessary since Sphinx 4.
|
||||
In Sphinx<4, we use favicon but need to prepend path info.
|
||||
#}
|
||||
{%- set _favicon_url = favicon_url | default(pathto('_static/' + (favicon or ""), 1)) %}
|
||||
{%- if favicon_url or favicon %}
|
||||
<link rel="shortcut icon" href="{{ _favicon_url }}"/>
|
||||
{%- endif %}
|
||||
|
||||
{#- CANONICAL URL (deprecated) #}
|
||||
{%- if theme_canonical_url and not pageurl %}
|
||||
@@ -133,22 +133,15 @@
|
||||
<div class="wy-side-nav-search" {% if theme_style_nav_header_background %} style="background: {{theme_style_nav_header_background}}" {% endif %}>
|
||||
{%- block sidebartitle %}
|
||||
|
||||
{%- if logo and theme_logo_only %}
|
||||
<a href="{{ pathto(master_doc) }}">
|
||||
{%- else %}
|
||||
<a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }}
|
||||
{%- endif %}
|
||||
|
||||
{%- if logo %}
|
||||
{#- Not strictly valid HTML, but it's the only way to display/scale
|
||||
it properly, without weird scripting or heaps of work
|
||||
#}
|
||||
{%- if sphinx_version_info < (4, 0) -%}
|
||||
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/>
|
||||
{%- else %}
|
||||
<img src="{{ logo_url }}" class="logo" alt="{{ _('Logo') }}"/>
|
||||
{# the logo helper function was removed in Sphinx 6 and deprecated since Sphinx 4 #}
|
||||
{# the master_doc variable was renamed to root_doc in Sphinx 4 (master_doc still exists in later Sphinx versions) #}
|
||||
{%- set _logo_url = logo_url|default(pathto('_static/' + (logo or ""), 1)) %}
|
||||
{%- set _root_doc = root_doc|default(master_doc) %}
|
||||
<a href="{{ pathto(_root_doc) }}"{% if not theme_logo_only %} class="icon icon-home"{% endif %}>
|
||||
{% if not theme_logo_only %}{{ project }}{% endif %}
|
||||
{%- if logo or logo_url %}
|
||||
<img src="{{ _logo_url }}" class="logo" alt="{{ _('Logo') }}"/>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
</a>
|
||||
|
||||
{%- if theme_display_version %}
|
||||
|
||||
Reference in New Issue
Block a user