Skip to content

Commit 2a07073

Browse files
🪲 BUG: Fix base_url undefined error in search functionality
- Move base_url variable definition to <head> section before any scripts load - Ensures base_url is available when search/main.js executes - Prevents 'Uncaught ReferenceError: base_url is not defined' error - Fixes issue where search scripts were loaded before base_url was defined
1 parent 30ff77e commit 2a07073

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎mkdocs_simple_blog/base.html‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
{%- block extrahead %}
3636
{%- endblock %}
3737

38+
<script>var base_url = '{{ base_url }}';</script>
39+
3840
{%- block styles %}
3941
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Fira+Mono:400,700">
4042
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
@@ -133,7 +135,6 @@
133135

134136
{%- block scripts %}
135137

136-
<script>var base_url = '{{ base_url }}';</script>
137138
<script src="{{ 'assets/js/jquery-3.3.1.slim.min.js"'|url }}"></script>
138139
<script src="{{ 'assets/js/bootstrap.bundle.min.js"'|url }}"></script>
139140
<script src="{{ 'assets/js/main.min.js"'|url }}"></script>

0 commit comments

Comments
 (0)