|
40 | 40 | <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
|
41 | 41 | {%- endfor -%}
|
42 | 42 |
|
43 |
| - {#- FAVICON #} |
44 |
| - {%- if favicon %} |
45 |
| - {%- if sphinx_version_info < (4, 0) -%} |
46 |
| - <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/> |
47 |
| - {%- else %} |
48 |
| - <link rel="shortcut icon" href="{{ favicon_url }}"/> |
49 |
| - {%- endif %} |
50 |
| - {%- endif -%} |
| 43 | + {#- FAVICON |
| 44 | + favicon_url is the only context var necessary since Sphinx 4. |
| 45 | + In Sphinx<4, we use favicon but need to prepend path info. |
| 46 | + #} |
| 47 | + {%- set _favicon_url = favicon_url | default(pathto('_static/' + (favicon or ""), 1)) %} |
| 48 | + {%- if favicon_url or favicon %} |
| 49 | + <link rel="shortcut icon" href="{{ _favicon_url }}"/> |
| 50 | + {%- endif %} |
51 | 51 |
|
52 | 52 | {#- CANONICAL URL (deprecated) #}
|
53 | 53 | {%- if theme_canonical_url and not pageurl %}
|
|
133 | 133 | <div class="wy-side-nav-search" {% if theme_style_nav_header_background %} style="background: {{theme_style_nav_header_background}}" {% endif %}>
|
134 | 134 | {%- block sidebartitle %}
|
135 | 135 |
|
136 |
| - {%- if logo and theme_logo_only %} |
137 |
| - <a href="{{ pathto(master_doc) }}"> |
138 |
| - {%- else %} |
139 |
| - <a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }} |
140 |
| - {%- endif %} |
141 |
| - |
142 |
| - {%- if logo %} |
143 |
| - {#- Not strictly valid HTML, but it's the only way to display/scale |
144 |
| - it properly, without weird scripting or heaps of work |
145 |
| - #} |
146 |
| - {%- if sphinx_version_info < (4, 0) -%} |
147 |
| - <img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/> |
148 |
| - {%- else %} |
149 |
| - <img src="{{ logo_url }}" class="logo" alt="{{ _('Logo') }}"/> |
| 136 | + {# the logo helper function was removed in Sphinx 6 and deprecated since Sphinx 4 #} |
| 137 | + {# the master_doc variable was renamed to root_doc in Sphinx 4 (master_doc still exists in later Sphinx versions) #} |
| 138 | + {%- set _logo_url = logo_url|default(pathto('_static/' + (logo or ""), 1)) %} |
| 139 | + {%- set _root_doc = root_doc|default(master_doc) %} |
| 140 | + <a href="{{ pathto(_root_doc) }}"{% if not theme_logo_only %} class="icon icon-home"{% endif %}> |
| 141 | + {% if not theme_logo_only %}{{ project }}{% endif %} |
| 142 | + {%- if logo or logo_url %} |
| 143 | + <img src="{{ _logo_url }}" class="logo" alt="{{ _('Logo') }}"/> |
150 | 144 | {%- endif %}
|
151 |
| - {%- endif %} |
152 | 145 | </a>
|
153 | 146 |
|
154 | 147 | {%- if theme_display_version %}
|
|
0 commit comments