diff --git a/docs/conf.py b/docs/conf.py index 5a27944c3..25d002c02 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -70,6 +70,7 @@ html_logo = "demo/static/logo-wordmark-light.svg" html_show_sourcelink = True +html_favicon = "demo/static/favicon.ico" htmlhelp_basename = slug diff --git a/docs/demo/static/favicon.ico b/docs/demo/static/favicon.ico new file mode 100644 index 000000000..42e8969ed Binary files /dev/null and b/docs/demo/static/favicon.ico differ diff --git a/sphinx_rtd_theme/layout.html b/sphinx_rtd_theme/layout.html index bb0c069a2..94a40cc1c 100644 --- a/sphinx_rtd_theme/layout.html +++ b/sphinx_rtd_theme/layout.html @@ -40,14 +40,14 @@ {%- endfor -%} - {#- FAVICON #} - {%- if favicon %} - {%- if sphinx_version_info < (4, 0) -%} - - {%- else %} - - {%- endif %} - {%- endif -%} + {#- FAVICON + favicon_url is the only context var necessary since Sphinx 4. + In Sphinx<4, we use favicon but need to prepend path info. + #} + {%- set _favicon_url = favicon_url | default(pathto('_static/' + (favicon or ""), 1)) %} + {%- if favicon_url or favicon %} + + {%- endif %} {#- CANONICAL URL (deprecated) #} {%- if theme_canonical_url and not pageurl %} @@ -133,22 +133,15 @@