Skip to content

Commit 5dc72a3

Browse files
committed
Prefetch the sidebar logos
1 parent 01eb613 commit 5dc72a3

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/furo/theme/furo/base.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@
3131
{%- if pageurl %}
3232
<link rel="canonical" href="{{ pageurl|e }}" />
3333
{%- endif %}
34+
35+
{%- block logo_prefetch_links %}
36+
{%- if logo_url %}
37+
<link rel="prefetch" href="{{ logo_url }}" as="image" />
38+
{%- endif %}
39+
{%- if theme_light_logo and theme_dark_logo %}
40+
<link rel="prefetch" href="{{ pathto('_static/' + theme_light_logo, 1) }}" as="image" />
41+
<link rel="prefetch" href="{{ pathto('_static/' + theme_dark_logo, 1) }}" as="image" />
42+
{%- endif %}
43+
{%- endblock logo_prefetch_links %}
3444
{%- endblock linktags %}
3545

3646
{# Favicon #}

src/furo/theme/furo/sidebar/brand.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
-#}
1414
<a class="sidebar-brand{% if logo %} centered{% endif %}" href="{{ pathto(master_doc) }}">
15-
{% block brand_content %}
15+
{%- block brand_content %}
16+
{#- Remember to update the prefetch logic in `block logo_prefetch_links` in base.html #}
1617
{%- if logo_url %}
1718
<div class="sidebar-logo-container">
1819
<img class="sidebar-logo" src="{{ logo_url }}" alt="Logo"/>

0 commit comments

Comments
 (0)