Skip to content

Commit 3532ffc

Browse files
tronicalBlendify
andauthored
Fix support for logos as urls (#1171)
* Fix support for logos as urls Sphinx since 4.0 appears to support html_logo to also contain urls. As a consequence, the other themes in sphinx appear to be just using the new logo_url variable, and in this theme that fixes support for it, too. * Add backwards compatibility and add favicon_url Co-authored-by: Aaron Carlisle <[email protected]>
1 parent 380647d commit 3532ffc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sphinx_rtd_theme/layout.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242

4343
{#- FAVICON #}
4444
{%- if favicon %}
45+
{%- if sphinx_version_info < (4, 0) -%}
4546
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
47+
{%- else %}
48+
<link rel="shortcut icon" href="{{ favicon_url }}"/>
49+
{%- endif %}
4650
{%- endif -%}
4751

4852
{#- CANONICAL URL (deprecated) #}
@@ -139,7 +143,11 @@
139143
{#- Not strictly valid HTML, but it's the only way to display/scale
140144
it properly, without weird scripting or heaps of work
141145
#}
146+
{%- if sphinx_version_info < (4, 0) -%}
142147
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/>
148+
{%- else %}
149+
<img src="{{ logo_url }}" class="logo" alt="{{ _('Logo') }}"/>
150+
{%- endif %}
143151
{%- endif %}
144152
</a>
145153

0 commit comments

Comments
 (0)