Creating a search page

This tutorial creates a search page to search all live pages under a site. The search page includes two search fields - one field to search the name of a page and its contents, and another field to search the description metadata of a page. On the results page, the user can perform another search.

Before you start

This tutorial requires the following knowledge and configuration prior to completing the steps:

Setting up the search page

  1. Create a search page under your site. The Details screen of the search page will be displayed.

  2. In the Root nodes field, select the site asset as the root node of the search page.

  3. In the Asset types to search for field, select Page and select Inherit.

  4. In the Search statuses field, select Live.

  5. In the Search forms field, select Customize search form.

Adding search fields

  1. On the Search fields screen, add two fields titled Name and Description.

  2. On the Name search field, add the Asset name, Asset short name, and Asset contents standard asset fields.

  3. On the Description search field, add a Description asset metadata field.

    The search fields of the search page

    source/matrix-documentation/documentation/modules/features/images

Defining the layout of the search page

  1. On the default search bodycopy, add the keyword replacements for the search fields. An example layout is shown in the figure:

    The WYSIWYG editor on the default search bodycopy
  2. On the initial search page layout bodycopy, add a heading for the page and the default search bodycopy. An example layout is shown in the figure:

    The WYSIWYG editor on the initial search page layout bodycopy
  3. On the results page layout, add a heading for the page, the query terms the user has searched for, and the default search bodycopy. An example layout is shown in the figure:

    WYSIWYG editor on the results page layout bodycopy

    The inclusion of the default search bodycopy will print the search fields on the results page, allowing users to perform another search.

  4. On the no results page layout, add a heading for the page and the default search bodycopy. An example layout is shown in the figure:

WYSIWYG editor on the no results page layout bodycopy

Using the search page

The layout of the search page is as defined in the initial search page layout bodycopy. An example layout is shown in the figure:

The layout of the search page
  1. The user performs a search. In this example, the user is searching for Squiz in the Name field and CMS in the Description field.

    1. If search results are found, the layout of the page will be as defined in the results page layout, as shown in the figure: In this example, one result has been found.

      The layout of the results page
    2. If no results are found from the search, the layout of the page will be as defined in the no results page layout, as shown in the figure:

      The layout of the no results page