diff --git a/sphinx_typo3_theme/layout.html b/sphinx_typo3_theme/layout.html
index ee4e919..ba5d9dc 100644
--- a/sphinx_typo3_theme/layout.html
+++ b/sphinx_typo3_theme/layout.html
@@ -54,7 +54,13 @@
{%- endfor %}
-
+ {# Sphinx >= 5.1 uses a styles list instead, only define that ourselves if not already existing #}
+ {%- if styles is not defined %}
+ {% set styles = [style] %}
+ {%- endif %}
+ {%- for style in styles %}
+
+ {%- endfor %}
{%- block linktags %}