summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-12-22 15:51:26 +0100
committerMartin Fischer <martin@push-f.com>2022-01-03 07:01:49 +0100
commit8e9ad1ccc296c220d61f12926c94d98baa83e3ca (patch)
tree5ba40ba51b65c5fae48c4b008ebe85d0563b7466 /docs
parent02e9bdf7550b5f5545bd842b24b71680960dd7a7 (diff)
downloadsearxng-8e9ad1ccc296c220d61f12926c94d98baa83e3ca.tar.gz
searxng-8e9ad1ccc296c220d61f12926c94d98baa83e3ca.zip
[enh] introduce categories_as_tabs
Previously all categories were displayed as search engine tabs. This commit changes that so that only the categories listed under categories_as_tabs in settings.yml are displayed. This lets us introduce more categories without cluttering up the UI. Categories not displayed as tabs can still be searched with !bangs.
Diffstat (limited to 'docs')
-rw-r--r--docs/admin/engines/configured_engines.rst12
-rw-r--r--docs/admin/engines/settings.rst20
-rw-r--r--docs/conf.py7
3 files changed, 32 insertions, 7 deletions
diff --git a/docs/admin/engines/configured_engines.rst b/docs/admin/engines/configured_engines.rst
index 82a1d2375..c7b6a1f52 100644
--- a/docs/admin/engines/configured_engines.rst
+++ b/docs/admin/engines/configured_engines.rst
@@ -16,11 +16,18 @@ Explanation of the :ref:`general engine configuration` shown in the table
SearXNG supports {{engines | length}} search engines (of which {{enabled_engine_count}} are enabled by default).
- {% for category, engines in categories.items() %}
+ {% for category, engines in categories_as_tabs.items() %}
{{category}} search engines
---------------------------------------
+ {% for group, engines in engines | group_engines_in_tab %}
+
+ {% if loop.length > 1 %}
+ {{group}}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ {% endif %}
+
.. flat-table::
:header-rows: 2
:stub-columns: 1
@@ -39,7 +46,7 @@ Explanation of the :ref:`general engine configuration` shown in the table
- Safe search
- Time range
- {% for mod in engines | sort_engines %}
+ {% for mod in engines %}
* - `{{mod.name}} <{{mod.about and mod.about.website}}>`_
- ``!{{mod.shortcut}}``
@@ -65,3 +72,4 @@ Explanation of the :ref:`general engine configuration` shown in the table
{% endfor %}
{% endfor %}
+ {% endfor %}
diff --git a/docs/admin/engines/settings.rst b/docs/admin/engines/settings.rst
index b04de7cb3..cf561a5ab 100644
--- a/docs/admin/engines/settings.rst
+++ b/docs/admin/engines/settings.rst
@@ -219,6 +219,26 @@ Communication with search engines.
``max_redirects`` :
30 by default. Maximum redirect before it is an error.
+``categories_as_tabs:``
+-----------------------
+
+A list of the categories that are displayed as tabs in the user interface.
+Categories not listed here can still be searched with the :ref:`search-syntax`.
+
+.. code-block:: yaml
+
+ categories_as_tabs:
+ - general
+ - images
+ - videos
+ - news
+ - map
+ - music
+ - it
+ - science
+ - files
+ - social media
+
.. _settings engine:
Engine settings
diff --git a/docs/conf.py b/docs/conf.py
index 1b78ece60..da989e62e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -50,14 +50,11 @@ jinja_contexts = {
},
'enabled_engine_count': sum(not x.disabled for x in searx.engines.engines.values()),
'categories': searx.engines.categories,
+ 'categories_as_tabs': {c: searx.engines.categories[c] for c in searx.settings['categories_as_tabs']},
},
}
jinja_filters = {
- 'sort_engines':
- lambda engines: sorted(
- engines,
- key=lambda engine: (engine.about.get('language', ''), engine.name)
- )
+ 'group_engines_in_tab': searx.engines.group_engines_in_tab,
}
# Let the Jinja template in configured_engines.rst access documented_modules