diff --git a/searx/templates/result_templates/default.html b/searx/templates/result_templates/default.html index 99789484a..f479ca701 100644 --- a/searx/templates/result_templates/default.html +++ b/searx/templates/result_templates/default.html @@ -1,4 +1,4 @@

{{ result.title|safe }}

-

{{ result.engine }}
{% if result.content %}{{ result.content|safe }}
{% endif %}{{ result.url }}

+

{{ result.engine }}
{% if result.content %}{{ result.content|safe }}
{% endif %}{{ result.pretty_url }}

diff --git a/searx/webapp.py b/searx/webapp.py index 7867d66f6..84835b826 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -79,6 +79,11 @@ def index(): selected_categories.append(ccateg) query = request_data['q'].encode('utf-8') results = search(query, request, selected_categories) + for result in results: + if len(result['url']) > 74: + result['pretty_url'] = result['url'][:35] + '[..]' + result['url'][-35:] + else: + result['pretty_url'] = result['url'] if request_data.get('format') == 'json': return Response(json.dumps({'query': query, 'results': results}), mimetype='application/json') template = render('results.html'