diff --git a/Code/Mantid/docs/source/_templates/layout.html b/Code/Mantid/docs/source/_templates/layout.html
index 64c3d1967dd4454f7edb6ca43c42318b796370f2..3728141dd335582b8c0efd8d135cd027070203e9 100644
--- a/Code/Mantid/docs/source/_templates/layout.html
+++ b/Code/Mantid/docs/source/_templates/layout.html
@@ -1,9 +1,6 @@
 {% extends "!layout.html" %}
 
 {% block extrahead %}
-{# Custom CSS overrides #}
-{% set bootswatch_css_custom = ['_static/custom.css'] %}
-
 {% if builder == "html" %}
 <script>
   (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -16,5 +13,7 @@
 
 </script>
 {% endif %}
-
 {% endblock %}
+
+{# Custom CSS overrides #}
+{% set bootswatch_css_custom = ['_static/custom.css'] %}