mirror of https://github.com/searxng/searxng.git
[enh] url prettify
This commit is contained in:
parent
d9011f673e
commit
ea475ee709
|
@ -1,4 +1,4 @@
|
|||
<div class="result">
|
||||
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
|
||||
<p class="content"><span class="engines">{{ result.engine }}</span><br />{% if result.content %}{{ result.content|safe }}<br />{% endif %}<span class="url">{{ result.url }}</span></p>
|
||||
<p class="content"><span class="engines">{{ result.engine }}</span><br />{% if result.content %}{{ result.content|safe }}<br />{% endif %}<span class="url">{{ result.pretty_url }}</span></p>
|
||||
</div>
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue