diff --git a/layout/_layout.swig b/layout/_layout.swig
index 847309887b..ba5f79e10b 100644
--- a/layout/_layout.swig
+++ b/layout/_layout.swig
@@ -66,7 +66,7 @@
@@ -80,20 +80,11 @@
{%- endif %}
- {% include '_partials/share/index.swig' %}
+ {{ partial('_partials/share/index.swig', {}, {cache: theme.cache.enable}) }}
- {% include '_scripts/vendors.swig' %}
- {% include '_scripts/commons.swig' %}
-
- {%- set scheme_script = '_scripts/schemes/' + theme.scheme | lower + '.swig' %}
- {% include scheme_script %}
-
- {% include '_scripts/next-boot.swig' %}
- {% include '_scripts/exturl.swig' %}
- {% include '_scripts/three.swig' %}
-
- {% include '_third-party/index.swig' %}
+ {{ partial('_scripts/index.swig', {}, {cache: theme.cache.enable}) }}
+ {{ partial('_third-party/index.swig', {}, {cache: theme.cache.enable}) }}
{%- if theme.pjax %}
diff --git a/layout/_partials/header/index.swig b/layout/_partials/header/index.swig
index 97f9b0fb25..2f451eb04f 100644
--- a/layout/_partials/header/index.swig
+++ b/layout/_partials/header/index.swig
@@ -1,5 +1,18 @@
{{ partial('_partials/header/brand.swig', {}, {cache: theme.cache.enable}) }}
-{% include 'menu.swig' %}
+
+
{%- for inject_item in theme.injects.header %}
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
diff --git a/layout/_partials/header/menu.swig b/layout/_partials/header/menu.swig
index 472782d5a5..8a9d2ea3df 100644
--- a/layout/_partials/header/menu.swig
+++ b/layout/_partials/header/menu.swig
@@ -1,48 +1,36 @@
{% import '../../_macro/menu/menu-item.swig' as menu_item %}
-
+ {%- set hasSearch = theme.algolia_search.enable || theme.local_search.enable %}
+ {%- if hasSearch %}
+
+ {%- endif %}
+
+{%- endif %}
diff --git a/layout/_scripts/index.swig b/layout/_scripts/index.swig
new file mode 100644
index 0000000000..ec08956f8e
--- /dev/null
+++ b/layout/_scripts/index.swig
@@ -0,0 +1,9 @@
+{% include 'vendors.swig' %}
+{% include 'commons.swig' %}
+
+{%- set scheme_script = 'schemes/' + theme.scheme | lower + '.swig' %}
+{% include scheme_script %}
+
+{% include 'next-boot.swig' %}
+{% include 'exturl.swig' %}
+{% include 'three.swig' %}