Layout assignments for search terms
You might want to customize the layout of the search results page for a specific search term. If so, we can create a layout and assign it directly to the search term. When a customer uses the search term to search the site, the search results page is rendered with your assigned layout instead of the default layout for the search results page. The following example shows the Search terms table in the Commerce Composer tool, where a layout is assigned to the search termlaptop:Figure 1. Assigning a layout to a search termTip: This scenario is different from typical layout assignments because we are assigning the layout directly to the search term, not to a page, even though the search results page is affected.
Commerce Composer widgets for search results pages
The widget library included with the Commerce Composer tool provides various widgets that we can use in a layout assigned to a search term. The following widgets provide the features of a typical search results page:
- Search Summary widget
- Catalog Entry List widget
- Site Content List widget
- Category Navigation widget
- Facet Navigation widget
We can also use widgets that are marked with an
Xin theWidgets for any pagecolumn in Commerce Composer widget library.
Synonyms for search terms
By default, layout assignments are extended to synonyms of the search term that you specify. The Commerce Composer tool checks for any existing synonyms that are defined in the Catalogs tool as search term associations. We can add new synonyms in the Catalogs tool whenever they are required. See Creating search term associations using synonyms and replacements.Here is an example of how a layout assignment is extended to the synonyms of a search term:
- You create a layout to use as the search results page for laptop computers.
- You assign your layout to the search term
laptop, as shown in Figure 1.- In the Catalogs tool, you set up the following synonyms for the search term
laptop: laptops, notebook, notebooksAs a result, the layout is used on the storefront when a customer searches using any of the following search terms:
- laptop
- laptops
- notebook
- notebooks
In the Store Management tool, a Use synonyms check box controls whether the layout assignment is extended to synonyms of the search term as described here. This store function is enabled by default, but we can disable the function if required. The Use synonyms check box is on the Configurations tab in the Store Management tool. See Selecting store functions.
Important: When you specify search terms and synonyms, include all variations of the term that you expect customers to use. For the layout to be assigned, the customer's search term must be an exact match to the search term or synonym.
Comparison: using the Catalogs tool to link a search term to a content page
Management Center offers another method for displaying a layout when a customer uses a specific search term to search the store. For this alternative method, complete these steps:
- In the Commerce Composer tool:
- Create a content page (a page URL) to use as a search landing page.
- Create a layout for the landing page and assign it to the content page.
- In the Catalogs tool, link the URL for the content page to the search terms. See Linking and unlinking search terms with landing pages.
If you use this method:
- Widgets that depend on the search term to display data will not work correctly. For content pages, the search term is not passed into the widget, so the widget cannot display the search-related data. All of the widgets listed earlier in this topic depend on the search term.
- We cannot run web activities in the widgets that depend on a search term. An example is a web activity that uses the Search Criteria and Results target.
Related concepts
Layouts, layout templates, and default layouts
Layout assignments for category pages
Layout assignments for catalog entry pages
Related tasks
Creating a layout for a page
Creating a layout for a search term
Populating tabbed slots in layout templates
Viewing the list of layouts assigned to a page
Copying a layout
Viewing information about widgets in store preview
Viewing information about pages and layouts in store preview
Linking and unlinking search terms with landing pages