diff --git a/Changelog.md b/Changelog.md
index a66bb3ffdf17058dce07240967bdca5c3b6a556b..73c3dcb63fba4db09e2a2d48acd25087510a4ae7 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -15,7 +15,7 @@
 * Don't display mail-related view content if it is disabled in the pod's config [#7190](https://github.com/diaspora/diaspora/pull/7190)
 * Use typeahead.js from rails-assets.org [#7192](https://github.com/diaspora/diaspora/pull/7192)
 * Refactor ShareVisibilitesController to use PostService [#7196](https://github.com/diaspora/diaspora/pull/7196)
-* Unify desktop and mobile head elements [#7194](https://github.com/diaspora/diaspora/pull/7194)
+* Unify desktop and mobile head elements [#7194](https://github.com/diaspora/diaspora/pull/7194) [#7209](https://github.com/diaspora/diaspora/pull/7209)
 * Refactor flash messages on ajax errors for comments, likes, reshares and aspect memberships [#7202](https://github.com/diaspora/diaspora/pull/7202)
 * Only require AWS-module for fog [#7201](https://github.com/diaspora/diaspora/pull/7201)
 * Only show community spotlight links on the contacts page if community spotlight is enabled [#7213](https://github.com/diaspora/diaspora/pull/7213)
diff --git a/app/views/application/_head.haml b/app/views/application/_head.haml
index 8019030c8a11452b5141a5bb16c1eb49c8ba2cb9..4972779763a52a88bec0755d0de085dc5ae23862 100644
--- a/app/views/application/_head.haml
+++ b/app/views/application/_head.haml
@@ -12,9 +12,6 @@
 / All others
 %link{rel: "shortcut icon", href: image_path("favicon.png")}
 
-= chartbeat_head_block
-= include_mixpanel
-
 - if rtl?
   = stylesheet_link_tag :rtl, media: "all"
 
@@ -22,9 +19,12 @@
   = stylesheet_link_tag :poltergeist_disable_transition, media: "all"
 
 = jquery_include_tag
+= include_gon(camel_case: true, nonce: content_security_policy_nonce(:script))
+= yield(:javascript)
+
+= chartbeat_head_block
+= csrf_meta_tag
 = current_user_atom_tag
+= include_mixpanel
 
 = yield(:head)
-
-= csrf_meta_tag
-= include_gon(camel_case: true, nonce: content_security_policy_nonce(:script))
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 0dbcaae99d16ed74d7bbd3b76c679b0097cdc4ac..8b4099a8ff628a759e85ce815e988504e7dbd5c4 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -5,18 +5,20 @@
 !!!
 %html{lang: I18n.locale.to_s, dir: (rtl? ? "rtl" : "ltr")}
   %head{prefix: og_prefix}
-    = render "head"
     %meta{name: "viewport", content: "width=device-width, initial-scale=1"}/
 
-    = include_color_theme
-    = old_browser_js_support
+    - content_for :javascript do
+      = old_browser_js_support
+
+      <!--[if IE]>
+      = javascript_include_tag :ie
+      <![endif]-->
 
-    <!--[if IE]>
-    = javascript_include_tag :ie
-    <![endif]-->
+      = javascript_include_tag :main, :templates
+      = load_javascript_locales
 
-    = javascript_include_tag :main, :templates
-    = load_javascript_locales
+    = render "head"
+    = include_color_theme
     = translation_missing_warnings
 
   %body{class: "page-#{controller_name} action-#{action_name}"}
diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml
index e65f3f459e28dacea91d739eeccceffa8e53b830..618327572f4981ab7933fb94e289953659986e36 100644
--- a/app/views/layouts/application.mobile.haml
+++ b/app/views/layouts/application.mobile.haml
@@ -5,6 +5,10 @@
 !!!
 %html{lang: I18n.locale.to_s, dir: (rtl? ? "rtl" : "ltr")}
   %head{prefix: og_prefix}
+    - content_for :javascript do
+      = javascript_include_tag "mobile/mobile"
+      = load_javascript_locales
+
     = render "head"
     = include_color_theme "mobile"
 
@@ -30,7 +34,5 @@
             = t("streams.activity.title")
         = yield
 
-    = javascript_include_tag "mobile/mobile"
-    = load_javascript_locales
     = include_chartbeat
     = include_mixpanel_guid