From 02e9bdf7550b5f5545bd842b24b71680960dd7a7 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Tue, 28 Dec 2021 12:51:29 +0100 Subject: [doc] engine tables: show engines in all categories Previously the documentation grouped the engines by their first category so e.g. YouTube and Invidious were only shown in the in the videos section but not in the music section. This commit fixes this by iterating over searx.engines.categories, which also has the added benefit that the sections are now in the same order as the tabs in the user interface. --- docs/admin/engines/configured_engines.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/admin/engines') diff --git a/docs/admin/engines/configured_engines.rst b/docs/admin/engines/configured_engines.rst index 0060d1b74..82a1d2375 100644 --- a/docs/admin/engines/configured_engines.rst +++ b/docs/admin/engines/configured_engines.rst @@ -16,7 +16,7 @@ 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 engines.items() | groupby('1.categories.0') %} + {% for category, engines in categories.items() %} {{category}} search engines --------------------------------------- @@ -39,9 +39,9 @@ Explanation of the :ref:`general engine configuration` shown in the table - Safe search - Time range - {% for name, mod in engines | sort_engines %} + {% for mod in engines | sort_engines %} - * - `{{name}} <{{mod.about and mod.about.website}}>`_ + * - `{{mod.name}} <{{mod.about and mod.about.website}}>`_ - ``!{{mod.shortcut}}`` - {%- if 'searx.engines.' + mod.__name__ in documented_modules %} :py:mod:`~searx.engines.{{mod.__name__}}` -- cgit v1.2.3 From 8e9ad1ccc296c220d61f12926c94d98baa83e3ca Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 22 Dec 2021 15:51:26 +0100 Subject: [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. --- docs/admin/engines/configured_engines.rst | 12 ++++++++++-- docs/admin/engines/settings.rst | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'docs/admin/engines') 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 -- cgit v1.2.3 From a4c2cfb837a3f92e2c0f0b8a0bac7a6e03499640 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Tue, 4 Jan 2022 18:00:45 +0100 Subject: [enh] change categories_as_tabs from a list to a dict The tab icon names are currently hard coded in the templates. This commit lets us introduce an icon property in the future, e.g: categories_as_tabs: general: icon: search-outline --- docs/admin/engines/settings.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'docs/admin/engines') diff --git a/docs/admin/engines/settings.rst b/docs/admin/engines/settings.rst index cf561a5ab..2d8288ddd 100644 --- a/docs/admin/engines/settings.rst +++ b/docs/admin/engines/settings.rst @@ -228,16 +228,16 @@ 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 + general: + images: + videos: + news: + map: + music: + it: + science: + files: + social media: .. _settings engine: -- cgit v1.2.3