diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html
index f8ec93e..ddad906 100644
--- a/docs/source/_templates/layout.html
+++ b/docs/source/_templates/layout.html
@@ -4,7 +4,8 @@
{% extends "!layout.html" %}
{% block sidebartitle %}
-
+{% set doc = root_doc if root_doc is defined else master_doc %}
+
{{ project }}
{%- set nav_version = version %}
{% if READTHEDOCS and current_version %}
@@ -15,7 +16,11 @@
{{ nav_version }}
{% endif %}
-
+ {% if logo_url is defined %}
+
+ {% elif logo is defined %}
+
+ {% endif %}
{% include "searchbox.html" %}
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 5611320..dd1beae 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -143,10 +143,7 @@ def setup(app):
# We have to set this ourselves, not only because it's useful for local
# testing, but also because if we don't then RTD will throw away our
# html_theme_options.
-import sphinx_rtd_theme # noqa: E402
-
html_theme = "sphinx_rtd_theme"
-html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
diff --git a/newsfragments/140.bugfix.rst b/newsfragments/140.bugfix.rst
new file mode 100644
index 0000000..3831faf
--- /dev/null
+++ b/newsfragments/140.bugfix.rst
@@ -0,0 +1 @@
+Fix documentation build error with Sphinx >= 6 by using ``logo_url`` instead of ``logo`` in the HTML template.