Skip to content

Commit

Permalink
allow move from header then init
Browse files Browse the repository at this point in the history
  • Loading branch information
Stubbe committed Sep 30, 2024
1 parent e687f39 commit 58b58ef
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Resources/views/storefront/layout/meta.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@
{% endif %}
{% if config('clerkio64.config.instantSearchEnabled') == 'true' and config('clerkio64.config.instantSearchInjectionPosition') == 'meta' %}
<span
class="clerk"
class="clerk clerk-move-to-body"

data-template="@{{ config('clerkio64.config.instantSearchContent') }}"
data-instant-search-suggestions="{{ config('clerkio64.config.instantSearchNumberOfSuggestions') }}"
data-instant-search-categories="{{ config('clerkio64.config.instantSearchNumberOfCategories') }}"
Expand All @@ -151,5 +152,18 @@
data-instant-search="{{ config('clerkio64.config.instantSearchInputSelector') ? config('clerkio64.config.instantSearchInputSelector') : '.header-search-input' }}"
data-instant-search-pages-type="{{ config('clerkio64.config.instantSearchPageTypes') ? config('clerkio64.config.instantSearchPageTypes') : 'all' }}">
</span>
<script>
((w, d) => {
const move = d.querySelectorAll(".clerk-move-to-body");
if(move){
move.forEach(el => {
document.body.appendChild(el);
})
if(typeof w.Clerk == 'function'){
w.Clerk("content", ".clerk-move-to-body");
}
}
})(window, document);
</script>
{% endif %}
{% endblock %}

0 comments on commit 58b58ef

Please sign in to comment.