summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--searx/static/img/icon_wikipedia.pngbin0 -> 14858 bytes
-rw-r--r--searx/templates/result_templates/default.html11
-rw-r--r--searx/templates/result_templates/featured_results.html10
-rw-r--r--searx/templates/results.html11
-rw-r--r--searx/webapp.py11
5 files changed, 29 insertions, 14 deletions
diff --git a/searx/static/img/icon_wikipedia.png b/searx/static/img/icon_wikipedia.png
new file mode 100644
index 000000000..911fa76f6
--- /dev/null
+++ b/searx/static/img/icon_wikipedia.png
Binary files differ
diff --git a/searx/templates/result_templates/default.html b/searx/templates/result_templates/default.html
index 48c0775ae..3f2d0f360 100644
--- a/searx/templates/result_templates/default.html
+++ b/searx/templates/result_templates/default.html
@@ -1,5 +1,14 @@
<div class="result {{ result.class }}">
- <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
+
+ {% if result['favicon'] %}
+ <div style="float:left; margin:2px;">
+ <img width="24" height="24" src="static/img/icon_{{result['favicon']}}.png" alt="{{result['favicon']}}.png" title="{{result['favicon']}}.png" />
+ </div>
+ {% endif %}
+
+ <div>
+ <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3></br>
<p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p>
<p class="url">{{ result.pretty_url }}</p>
+ </div>
</div>
diff --git a/searx/templates/result_templates/featured_results.html b/searx/templates/result_templates/featured_results.html
new file mode 100644
index 000000000..4aeddfe24
--- /dev/null
+++ b/searx/templates/result_templates/featured_results.html
@@ -0,0 +1,10 @@
+<div id="fr">
+ {% for result in featured_results %}
+
+ {% if result['template'] %}
+ {% include 'result_templates/'+result['template'] %}
+ {% else %}
+ {% include 'result_templates/default.html' %}
+ {% endif %}
+ {% endfor %}
+</div>
diff --git a/searx/templates/results.html b/searx/templates/results.html
index 411f84c64..b35416ffa 100644
--- a/searx/templates/results.html
+++ b/searx/templates/results.html
@@ -15,16 +15,7 @@
Number of results: {{ number_of_results }}
</div>
{% if featured_results %}
- <div id="fr">
-
- {% for result in featured_results %}
- {% if result['template'] %}
- {% include 'result_templates/'+result['template'] %}
- {% else %}
- {% include 'result_templates/default.html' %}
- {% endif %}
- {% endfor %}
- </div>
+ {% include 'result_templates/featured_results.html' %}
{% endif %}
{% for result in results %}
diff --git a/searx/webapp.py b/searx/webapp.py
index 72395709c..5fc981a89 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -140,9 +140,14 @@ def index():
else:
result['pretty_url'] = result['url']
- if 'wikipedia' in result['engines'] or 'ddg definitions' in result['engines']:
- featured_results.append(result)
- results.remove(result)
+ for engine in result['engines']:
+ if engine in ['wikipedia']:
+ result['favicon'] = engine
+ featured_results.append(result)
+ results.remove(result)
+ elif engine in ['ddg definitions']:
+ featured_results.append(result)
+ results.remove(result)
if request_data.get('format') == 'json':
return Response(json.dumps({'query': query, 'results': results}), mimetype='application/json')