From 937165853185ca16b0da6f72bc42bd1487ea0dcb Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 13 Oct 2025 09:28:42 +0200 Subject: [mod] typification of SearXNG: add new result type File This PR adds a new result type: File Python class: searx/result_types/file.py Jinja template: searx/templates/simple/result_templates/file.html CSS (less) client/simple/src/less/result_types/file.less Class 'File' (singular) replaces template 'files.html' (plural). The renaming was carried out because there is only one file (singular) in a result. Not to be confused with the category 'files' where in multiple results can exist. As mentioned in issue [1], the class '.category-files' was removed from the CSS and the stylesheet was adopted in result_types/file.less (there based on the templates and no longer based on the category). [1] https://github.com/searxng/searxng/issues/5198 Signed-off-by: Markus Heiser --- searx/templates/simple/result_templates/file.html | 74 +++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 searx/templates/simple/result_templates/file.html (limited to 'searx/templates/simple/result_templates/file.html') diff --git a/searx/templates/simple/result_templates/file.html b/searx/templates/simple/result_templates/file.html new file mode 100644 index 000000000..c2ec66ede --- /dev/null +++ b/searx/templates/simple/result_templates/file.html @@ -0,0 +1,74 @@ +{% from "simple/macros.html" import result_header, result_sub_header, result_sub_footer, result_footer, result_link with context %} +{% from "simple/icons.html" import icon_small %} + +{{ result_header(result, favicons, image_proxify) }} +{{ result_sub_header(result) }} + +{% if result.abstract %} +

{{ result.abstract|safe }}

+{% endif -%} + +{%- if result.content %} +

{{ result.content|safe }}

+{% endif -%} + +
+ {% if result.author %} +
+ {{ _("Author") }}: + {{ result.author }} +
+ {% endif %} + {% if result.filename %} +
+ {{ _("Filename") }}: + {{ result.filename }} +
+ {% endif %} + {% if result.size %} +
+ {{ _("Filesize") }}: + {{ result.size }} +
+ {% endif %} + {% if result.time %} +
+ {{ _("Date") }}: + {{ result.time }} +
+ {% endif %} + {% if result.mimetype %} +
+ {{ _("Type") }}: + {{ result.mimetype }} +
+ {% endif %} +
+ +{% if result.embedded %} + {% if result.mtype in ("audio", "video") %} + + + {% else %} + + {% endif %} +{% endif %} + +{{ result_sub_footer(result) }} +{{ result_footer(result) }} -- cgit v1.2.3