Table of Contents
Usage
Append ?query=search+query to the pages URL to search pages by file name or file content.
Add this snippet just before the </header> in header.php file of your active layout to add the default search form:
<search>
<?= self::form('search'); ?>
</search>You can also define specific search query parameter key and route in this default search form component:
<search>
<?= self::form('search', [
'key' => 'search.term', // Custom search query
'route' => '/product/zoids' // Custom search context
]); ?>
</search>This page conditional statement is available to quickly determine the type of page we are currently in:
$site->has('query')- Return
trueif current page is a search results page.
Recursive Search
There is a recursive page search feature available from the /search route:
<search>
<?= self::form('search', ['route' => '/search']); ?>
</search>If there is a page file stored as .\lot\page\search.archive or .\lot\page\search.page, then that file will come first. To avoid this route conflict, you can change the default search route (which is '/search') to something else in the state file.
0 Comments
No comments yet.