Skip to content

Commit

Permalink
Use only logo_url on Sphinx 4+, logo on Sphinx<4
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaoming committed Jan 11, 2023
1 parent 2142c6d commit 7625462
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions sphinx_rtd_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,22 @@
<div class="wy-side-nav-search" {% if theme_style_nav_header_background %} style="background: {{theme_style_nav_header_background}}" {% endif %}>
{%- block sidebartitle %}

{%- if ( logo or logo_url ) and theme_logo_only %}
{%- if logo and theme_logo_only %}
<a href="{{ pathto(master_doc) }}">
{%- else %}
<a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }}
{%- endif %}

{%- if sphinx_version_info < (4, 0) -%}
{# the logo helper function was removed in Sphinx 6 and deprecated since Sphinx 4 #}
{%- if logo %}
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/>
{%- endif %}
{# Behavior since Sphinx 4 #}
{%- else %}
{% if logo_url %}
<img src="{{ logo_url }}" class="logo" alt="{{ _('Logo') }}"/>
{%- 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') }}"/>
{%- endif %}
{%- endif %}

</a>

{%- if theme_display_version %}
Expand Down

0 comments on commit 7625462

Please sign in to comment.