From 4b4210e9e27e233ba07de8854c00dafb61d8abc0 Mon Sep 17 00:00:00 2001 From: razonyang Date: Sun, 7 May 2023 19:42:21 +0800 Subject: [PATCH] Add support for customizing the search input partial --- layouts/partials/search-input.html | 2 ++ userguide/content/en/docs/adding-content/navigation.md | 1 + 2 files changed, 3 insertions(+) diff --git a/layouts/partials/search-input.html b/layouts/partials/search-input.html index feb1e74460..e3b929d932 100644 --- a/layouts/partials/search-input.html +++ b/layouts/partials/search-input.html @@ -33,4 +33,6 @@ data-offline-search-max-results="{{ .Site.Params.offlineSearchMaxResults | default 10 }}" > +{{ else if templates.Exists "partials/search-input-custom.html" -}} + {{ partialCached "search-input-custom" . }} {{ end -}} diff --git a/userguide/content/en/docs/adding-content/navigation.md b/userguide/content/en/docs/adding-content/navigation.md index d56af26671..a9147ec866 100644 --- a/userguide/content/en/docs/adding-content/navigation.md +++ b/userguide/content/en/docs/adding-content/navigation.md @@ -316,6 +316,7 @@ Docsy offers multiple options that let your readers search your site content, so * [Google Custom Search Engine](#configure-search-with-a-google-custom-search-engine) (GCSE), the default option, which uses Google's index of your public site to generate a search results page. * [Algolia DocSearch](#configure-algolia-docsearch), which uses Algolia's indexing and search mechanism, and provides an organized dropdown of search results when your readers use the search box. Algolia DocSearch is free for public documentation sites. * [Local search with Lunr](#configure-local-search-with-lunr), which uses Javascript to index and search your site without the need to connect to external services. This option doesn't require your site to be public. +* Custom search, which used to customize search input by creating the `layouts/partials/search-input-custom.html`, you'll need to disable other search options. If you enable any of these search options in your project [configuration file], a search box displays in the right of your top navigation bar. By default a search box also displays at the top of the section menu in the left navigation pane, which you can disable if you prefer, or if you're using a search option that only works with the top search box.