Default Search#
Use search on the query tag:
{{ search }} <input type="search" placeholder="Search"> <button>Search</button>{{ /search }}{{ query:posts search }} <h2><a href="{{ url }}">{{ title }}</a></h2>{{ /query:posts }}If the search box is empty, the query still works as a normal query.
Named Search#
Use a name when the page has a specific search for a specific list:
{{ search name="projects" param="keyword" in="title" }} <input type="search" placeholder="Search projects"> <button>Search</button>{{ /search }}{{ query:project search="projects" }} <h2><a href="{{ url }}">{{ title }}</a></h2>{{ /query:project }}The query uses the form named projects, reads the keyword parameter, and searches project titles.
With Other Query Options#
Search can sit beside normal query options:
{{ query:project search="projects" sort="title:asc" }}The search narrows the query. The other options still decide what kind of content is queried and how it is ordered.
Use a {{ sort }} control inside the matching search form when the reader should choose the order from the page. See Search Sorting.