Search Form

To create a search form, first create a normal HTML form with a search input:

<form action="{{ url('search/results') }}">
    <input type="search" name="q" placeholder="Search">
    <input type="submit" value="Go">

Then, on whatever template your form submits to (e.g. search/results.twig), just pull the search query from the GET/POST data, and pass it to the search entry query param:

<h1>Search Results</h1>

{% set searchQuery ='q') %}
{% set entries = craft.entries()
    .all() %}

{% if entries|length %}
    <p>{{ entries|length }} results:</p>

        {% for entry in entries %}
            <li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
        {% endfor %}
{% else %}
    <p>Your search for “{{ searchQuery }}” didn’t return any results.</p>
{% endif %}