FaraiBikeshedComponents

engine-search-form.html

There isn’t much to this, just making a form that lets you search this site via Google. Currently used on this site’s search page. Hope to add other search engines in the future. Ultimate goal is implementing a search engine.

Source Code

{{- $urlObj := urls.Parse site.BaseURL -}}
<form action="https://www.google.com/search" method="get" name="search-form">
    <search role="search">
        <label for="search-form_query" class="visually-hidden">
            Search Term
        </label>        
        <input class="search-form_query" type="text" name="q" id="search-form_query" value="">
        <input class="search-form_query" type="text" name="q" value=" site:{{ $urlObj.Host }} " hidden>
        <button class="search-form_button" type="submit">Search Google</button>
    </search>
</form>

The shortcode, for reasons you will see shortly.

{{ partial "engine-search-form.html" . }}

Search From This Very Page

Because why not?