From 3f6a0cc9fbc9139f4e56b346f5ac8f438eaee6fd Mon Sep 17 00:00:00 2001 From: Mehdi Nassim KHODJA Date: Sat, 15 Mar 2025 12:39:41 +0100 Subject: [PATCH] feat: add project-scoped search bar to sidebar Currently, the theme has 2 different search options: - Project-scoped search (page search.html) - OpenStack-wide search (on the top of the page, header.html) This change adds a sidebar that allows us to perform project-scoped search directly from the sidebar from any page. It's disabled by default but can be enabled via configuration. Global search placeholder text has been updated to "Global Search" in both themes (openstackdocs and starlingxdocs) to avoid confusion. Change-Id: I4783c1efebc067532f1392d1d5c2d841ad895f39 Signed-off-by: Mehdi Nassim KHODJA --- doc/source/index.rst | 9 +++++++++ openstackdocstheme/theme/openstackdocs/header.html | 2 +- openstackdocstheme/theme/openstackdocs/sidebartoc.html | 6 ++++++ openstackdocstheme/theme/openstackdocs/theme.conf | 1 + openstackdocstheme/theme/starlingxdocs/header.html | 2 +- .../notes/add-sidebar-search-0e62a9438dca8309.yaml | 4 ++++ 6 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/add-sidebar-search-0e62a9438dca8309.yaml diff --git a/doc/source/index.rst b/doc/source/index.rst index 5be1b2ab..601cbdca 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -170,6 +170,15 @@ navigation in the ``html_theme_options`` in the ``conf.py`` file:: # ... } +The search bar in the sidebar is disabled by default. To enable it, set +the ``sidebar_search`` option to ``True`` for project-scoped search:: + + html_theme_options = { + # ... + "sidebar_search": True, + # ... + } + If you are using this theme for documentation you want to release based on git tags on your repository, set the release dropdown menu option in the ``html_theme_options`` in the ``conf.py`` file. By default it is set to diff --git a/openstackdocstheme/theme/openstackdocs/header.html b/openstackdocstheme/theme/openstackdocs/header.html index b002cae3..248639dc 100644 --- a/openstackdocstheme/theme/openstackdocs/header.html +++ b/openstackdocstheme/theme/openstackdocs/header.html @@ -17,7 +17,7 @@ Toggle navigation -
Search
+
Global Search