Skip to content

Commit

Permalink
Fix support for logos as urls (#1171)
Browse files Browse the repository at this point in the history
* 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 <carlisle.b3d@gmail.com>
  • Loading branch information
tronical and Blendify authored Jul 20, 2021
1 parent 380647d commit 3532ffc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sphinx_rtd_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@

{#- 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 -%}

{#- CANONICAL URL (deprecated) #}
Expand Down Expand Up @@ -139,7 +143,11 @@
{#- 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>

Expand Down

0 comments on commit 3532ffc

Please sign in to comment.