diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html
index 71df123ea..650ef771c 100644
--- a/searx/templates/simple/base.html
+++ b/searx/templates/simple/base.html
@@ -32,7 +32,7 @@
{% endblock %}
{% if errors %}
diff --git a/searx/webapp.py b/searx/webapp.py
index f3f5f21b8..2ba8ccfb8 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -355,17 +355,12 @@ def render(template_name, override_theme=None, **kwargs):
if (engine_name, category) not in disabled_engines)
if 'categories' not in kwargs:
- kwargs['categories'] = ['general']
- kwargs['categories'].extend(x for x in
- sorted(categories.keys())
- if x != 'general'
- and x in enabled_categories)
+ kwargs['categories'] = [x for x in
+ _get_ordered_categories()
+ if x in enabled_categories]
if 'all_categories' not in kwargs:
- kwargs['all_categories'] = ['general']
- kwargs['all_categories'].extend(x for x in
- sorted(categories.keys())
- if x != 'general')
+ kwargs['all_categories'] = _get_ordered_categories()
if 'selected_categories' not in kwargs:
kwargs['selected_categories'] = []
@@ -430,6 +425,7 @@ def render(template_name, override_theme=None, **kwargs):
kwargs['brand'] = brand
kwargs['scripts'] = set()
+ kwargs['endpoint'] = 'results' if 'q' in kwargs else request.endpoint
for plugin in request.user_plugins:
for script in plugin.js_dependencies:
kwargs['scripts'].add(script)
@@ -443,6 +439,17 @@ def render(template_name, override_theme=None, **kwargs):
'{}/{}'.format(kwargs['theme'], template_name), **kwargs)
+def _get_ordered_categories():
+ ordered_categories = []
+ if 'categories_order' not in settings['ui']:
+ ordered_categories = ['general']
+ ordered_categories.extend(x for x in sorted(categories.keys()) if x != 'general')
+ return ordered_categories
+ ordered_categories = settings['ui']['categories_order']
+ ordered_categories.extend(x for x in sorted(categories.keys()) if x not in ordered_categories)
+ return ordered_categories
+
+
@app.before_request
def pre_request():
request.start_time = time()