diff --git a/src/layouts/404.hbs b/src/layouts/404.hbs
index 662b242..0caff6f 100644
--- a/src/layouts/404.hbs
+++ b/src/layouts/404.hbs
@@ -1,10 +1,9 @@
-
-
+{{> head-first}}
{{{detag (or page.title 'Page Not Found')}}}{{#if site.title}} | {{{site.title}}}{{/if}}
-{{> head}}
+{{> head-last}}
{{> header}}
diff --git a/src/layouts/default.hbs b/src/layouts/default.hbs
index a652857..bc05c24 100644
--- a/src/layouts/default.hbs
+++ b/src/layouts/default.hbs
@@ -1,20 +1,12 @@
-
-{{> head-redirect}}
-
+{{> head-first}}
{{{detag (or page.title 'Untitled')}}}{{#if site.title}} | {{{site.title}}}{{/if}}
{{#if page.canonicalUrl}}
{{/if}}
- {{#if page.description}}
-
- {{/if}}
- {{#if page.keywords}}
-
- {{/if}}
-{{> head}}
+{{> head-last}}
{{> header}}
diff --git a/src/layouts/home.hbs b/src/layouts/home.hbs
index 3158f6a..889756a 100644
--- a/src/layouts/home.hbs
+++ b/src/layouts/home.hbs
@@ -1,20 +1,12 @@
-
-{{> head-redirect}}
-
+{{> head-first}}
Couchbase Documentation
{{#if site.url}}
{{/if}}
- {{#if page.description}}
-
- {{/if}}
- {{#if page.keywords}}
-
- {{/if}}
-{{> head}}
+{{> head-last}}
{{> header}}
diff --git a/src/partials/head-first.hbs b/src/partials/head-first.hbs
new file mode 100644
index 0000000..dc53e80
--- /dev/null
+++ b/src/partials/head-first.hbs
@@ -0,0 +1,8 @@
+
+ {{#if (eq env.FORCE_HTTPS 'true')}}
+
+ {{/if}}
+ {{#if site.keys.googleAnalytics}}
+
+ {{/if}}
+
diff --git a/src/partials/head-last.hbs b/src/partials/head-last.hbs
new file mode 100644
index 0000000..ae71c44
--- /dev/null
+++ b/src/partials/head-last.hbs
@@ -0,0 +1,3 @@
+
+{{> head-meta}}
+{{> head-scripts}}
diff --git a/src/partials/head-meta.hbs b/src/partials/head-meta.hbs
index ae8bbf5..6ee5d7b 100644
--- a/src/partials/head-meta.hbs
+++ b/src/partials/head-meta.hbs
@@ -1,4 +1,10 @@
{{#if page.component}}
+ {{#if page.description}}
+
+ {{/if}}
+ {{#if page.keywords}}
+
+ {{/if}}
@@ -6,5 +12,4 @@
{{#if (or antoraVersion site.antoraVersion)}}
{{/if}}
-
diff --git a/src/partials/head-redirect.hbs b/src/partials/head-redirect.hbs
deleted file mode 100644
index 7eae7c0..0000000
--- a/src/partials/head-redirect.hbs
+++ /dev/null
@@ -1,3 +0,0 @@
- {{#if (eq env.FORCE_HTTPS 'true')}}
-
- {{/if}}
diff --git a/src/partials/head-scripts.hbs b/src/partials/head-scripts.hbs
index d113389..e69de29 100644
--- a/src/partials/head-scripts.hbs
+++ b/src/partials/head-scripts.hbs
@@ -1,6 +0,0 @@
-{{#if site.keys.googleAnalytics}}
-{{#with site.keys.googleAnalytics}}
-
-
-{{/with}}
-{{/if}}
diff --git a/src/partials/head.hbs b/src/partials/head.hbs
deleted file mode 100644
index b4ee621..0000000
--- a/src/partials/head.hbs
+++ /dev/null
@@ -1,2 +0,0 @@
-{{> head-meta}}
-{{> head-scripts}}