diff --git a/netbox/templates/base/layout.html b/netbox/templates/base/layout.html
index 04ab9314b..9365df43b 100644
--- a/netbox/templates/base/layout.html
+++ b/netbox/templates/base/layout.html
@@ -126,6 +126,9 @@ Blocks:
{% endif %}
{# /Bottom banner #}
+ {# BS5 pop-up modals #}
+ {% block modals %}{% endblock %}
+
{# Page footer #}
@@ -197,8 +200,5 @@ Blocks:
{# /Page content #}
- {# BS5 pop-up modals #}
- {% block modals %}{% endblock %}
-
{% endblock layout %}