diff --git a/searx/templates/opensearch.xml b/searx/templates/opensearch.xml
new file mode 100644
index 000000000..68b030b3a
--- /dev/null
+++ b/searx/templates/opensearch.xml
@@ -0,0 +1,14 @@
+
+
+ searx
+ Search searx
+ UTF-8
+ searx metasearch
+ {% if method == 'get' %}
+
+ {% else %}
+
+
+
+ {% endif %}
+
diff --git a/searx/webapp.py b/searx/webapp.py
index 42206435e..820775c8b 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -48,19 +48,6 @@ favicons = ['wikipedia', 'youtube', 'vimeo', 'soundcloud',
'twitter', 'stackoverflow', 'github']
-opensearch_xml = '''
-
- searx
- Search searx
- UTF-8
- searx meta search engine
-
-
-
-
-'''
-
-
@babel.localeselector
def get_locale():
locale = request.accept_languages.best_match(settings['locales'].keys())
@@ -298,13 +285,11 @@ Disallow: /engines
@app.route('/opensearch.xml', methods=['GET'])
def opensearch():
- global opensearch_xml
method = 'post'
# chrome/chromium only supports HTTP GET....
if request.headers.get('User-Agent', '').lower().find('webkit') >= 0:
method = 'get'
- base_url = get_base_url()
- ret = opensearch_xml.format(method=method, host=base_url)
+ ret = render('opensearch.xml', method=method, host=get_base_url())
resp = Response(response=ret,
status=200,
mimetype="application/xml")