diff --git a/templates/html.template b/templates/html.template
index 820279939..1d07a2cfb 100644
--- a/templates/html.template
+++ b/templates/html.template
@@ -41,12 +41,12 @@ $for(header-includes)$
$endfor$
-$if(title)$
-$title$
-$endif$
$for(include-before)$
$include-before$
$endfor$
+$if(title)$
+$title$
+$endif$
$if(toc)$
$toc$
$endif$
diff --git a/tests/s5.inserts.html b/tests/s5.inserts.html
index 0af12ffaa..69ab6f5e1 100644
--- a/tests/s5.inserts.html
+++ b/tests/s5.inserts.html
@@ -11,8 +11,8 @@
STUFF INSERTED
-My S5 Document
STUFF INSERTED
+My S5 Document
First slide