summaryrefslogtreecommitdiff
path: root/searx/templates/simple
diff options
context:
space:
mode:
authorYaksh Bariya <yakshbari4@gmail.com>2024-05-02 15:44:45 +0530
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-05-04 06:55:37 +0200
commitd577817646b12c9460765117ffcacff2b65bf18c (patch)
tree95baef243d54189bdf4f8ca003c699ee692c743f /searx/templates/simple
parent78077126f2fdc1e31d782cc8cd6e25ad9e6571ed (diff)
downloadsearxng-d577817646b12c9460765117ffcacff2b65bf18c.tar.gz
searxng-d577817646b12c9460765117ffcacff2b65bf18c.zip
[fix] respect user preferences to open links in new tab for short answers
Previously only result urls were set to open in new tab by default, this should make the behaviour consistent. Also adds the missing rel="noreferrer" to the anchor tag. Although this should not be needed as long as the `referrer-policy: no-referrer` header is set, it's always nice to play safer than to have to say sorry. For example some reverse proxy configurations might strip off unwhitelisted headers in which case it's nice to have this set.
Diffstat (limited to 'searx/templates/simple')
-rw-r--r--searx/templates/simple/results.html8
1 files changed, 6 insertions, 2 deletions
diff --git a/searx/templates/simple/results.html b/searx/templates/simple/results.html
index 7d97c9e06..52b474c77 100644
--- a/searx/templates/simple/results.html
+++ b/searx/templates/simple/results.html
@@ -24,8 +24,12 @@
{%- for answer in answers.values() -%}
<div class="answer">
<span>{{ answer.answer }}</span>
- {% if answer.url -%}
- <a href="{{ answer.url }}" class="answer-url">{{ urlparse(answer.url).hostname }}</a>
+ {%- if answer.url -%}
+ <a href="{{ answer.url }}" class="answer-url"
+ {%- if results_on_new_tab %} target="_blank" rel="noopener noreferrer"
+ {%- else -%} rel="noreferrer"
+ {%- endif -%}
+ >{{ urlparse(answer.url).hostname }}</a>
{% endif -%}
</div>
{%- endfor -%}