]> git.ipfire.org Git - ipfire.org.git/commitdiff
base: Add search to navigation when on docs
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 27 Jun 2023 08:17:38 +0000 (08:17 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 27 Jun 2023 08:17:38 +0000 (08:17 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/base.html

index 2aaf7dc884720a77aa489fb57e85e62c7f2881ee..5e38cdcf7a9c8024a17a52f4b4b8ccd5995fbf0d 100644 (file)
@@ -39,6 +39,7 @@
                                                        {% end %}
                                                </strong>
                                        </a>
+
                                        <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarMainMenu">
                                                <span aria-hidden="true"></span>
                                                <span aria-hidden="true"></span>
                                        {% block menu %}
                                                {% if hostname.startswith("www.") or hostname.startswith("dev.") %}
                                                        <div class="navbar-end">
+                                                               {# Show a search bar for docs #}
+                                                               {% if request.path.startswith("/docs") %}
+                                                                       <div class="navbar-item">
+                                                                               <form action="/docs/search" method="GET">
+                                                                                       <div class="field">
+                                                                                               <div class="control has-icons-left">
+                                                                                                       <input class="input" type="text"
+                                                                                                               name="q" {% if "q" in locals() and q %}value="{{ q }}"{% end %}
+                                                                                                               placeholder="{{ _("Search Docs...") }}">
+                                                                                                       <span class="icon is-small is-left">
+                                                                                                               <i class="fas fa-search"></i>
+                                                                                                       </span>
+                                                                                               </div>
+                                                                                       </div>
+                                                                               </form>
+                                                                       </div>
+                                                               {% end %}
+
                                                                <a class="navbar-item {% if request.path == "/about" %}is-active{% end %}" href="/about">{{ _("About") }}</a>
 
                                                                <a class="navbar-item {% if request.path.startswith("/download") %}is-active{% end %}" href="/download">{{ _("Download") }}</a>