git: ac4fd34edf - main - Doc: Move search functionality from DDG to our custom search engine

From: Sergio Carlavilla Delgado <carlavilla_at_FreeBSD.org>
Date: Sat, 19 Aug 2023 08:21:11 UTC
The branch main has been updated by carlavilla:

URL: https://cgit.FreeBSD.org/doc/commit/?id=ac4fd34edfa1e5e2edb6fb9fc61acd782a0ed33b

commit ac4fd34edfa1e5e2edb6fb9fc61acd782a0ed33b
Author:     Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
AuthorDate: 2023-08-19 08:09:34 +0000
Commit:     Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
CommitDate: 2023-08-19 08:09:34 +0000

    Doc: Move search functionality from DDG to our custom search engine
    
    Move search functionality from DDG to our custom search engine.
    In this way we will improve the privacy since nobody outside the
    FreeBSD Project will have the data.
    
    Thanks to bapt@ to install and configure the search engine
    
    Approved by:    doceng(implicit)
---
 .../themes/beastie/layouts/partials/global-search.html         | 10 ++++------
 documentation/themes/beastie/layouts/partials/site-header.html | 10 ++++------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/documentation/themes/beastie/layouts/partials/global-search.html b/documentation/themes/beastie/layouts/partials/global-search.html
index 414de88b13..26b3c0db4b 100644
--- a/documentation/themes/beastie/layouts/partials/global-search.html
+++ b/documentation/themes/beastie/layouts/partials/global-search.html
@@ -6,12 +6,10 @@
     </a>
   </div>
   <p>{{ i18n "freebsd-documentation-main-desc" }}</p>
-  <form class="search" method="get" id="search-form" action="https://duckduckgo.com/" onsubmit="document.getElementById('global-search-input').value+=' site:docs.FreeBSD.org OR site:man.FreeBSD.org OR site:wiki.FreeBSD.org'" name="search-form">
-    <input type="hidden" name="ka" value="v">
-    <input type="hidden" name="kt" value="v">
-    <input type="hidden" name="kh" value="1">
-    <input type="hidden" name="kj" value="r2">
-    <input id="global-search-input" name="q" type="text" size="20" maxlength="255" onfocus="if( this.value==this.defaultValue ) this.value='';" value="" placeholder="{{ i18n "global-search-placeholder" }}">
+  {{ $currentLanguage := $.Site.Language }}
+  <form class="search" method="get" id="search-form" action="https://docs.freebsd.org/search" name="search-form">
+    <input type="hidden" name="DB" value="{{ $currentLanguage }}" />
+    <input id="global-search-input" name="P" type="text" size="20" maxlength="255" value="" placeholder="{{ i18n "global-search-placeholder" }}">
     <span>&nbsp;</span>
   </form>
 </section>
diff --git a/documentation/themes/beastie/layouts/partials/site-header.html b/documentation/themes/beastie/layouts/partials/site-header.html
index 9c1af5071c..642ca7e468 100755
--- a/documentation/themes/beastie/layouts/partials/site-header.html
+++ b/documentation/themes/beastie/layouts/partials/site-header.html
@@ -86,12 +86,10 @@
       </ul>
     </nav>
     <div class="search-donate-container">
-      <form class="search" method="get" id="search-header-form" action="https://duckduckgo.com/" onsubmit="document.getElementById('words').value+=' site:FreeBSD.org'" name="search-header-form">
-        <input type="hidden" name="ka" value="v" />
-        <input type="hidden" name="kt" value="v" />
-        <input type="hidden" name="kh" value="1" />
-        <input type="hidden" name="kj" value="r2" />
-        <input id="words" name="q" type="text" size="20" maxlength="255" onfocus="if( this.value==this.defaultValue ) this.value='';" />
+      {{ $currentLanguage := $.Site.Language }}
+      <form class="search" method="get" id="search-header-form" action="https://docs.freebsd.org/search" name="search-header-form">
+        <input type="hidden" name="DB" value="{{ $currentLanguage }}" />
+        <input id="words" name="P" type="text" size="20" maxlength="255" value="" />
         <button>
           <i class="fa fa-search" aria-hidden="true"></i>
         </button>