Search

Finds pages by search query.

0 stars out of 5

0 0 0 0 0
  • Author Taufik Nurrohman
  • Maintainer 1
  • Member
  • Version 3.0.1
Table of Contents
  1. Usage
  2. Recursive Search

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 true if current page is a search results page.

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.