{module_searchresults}

Description

Displays site-wide search results. This module can be placed on the same web page/template as the search box or on a different page. In the second case the action URL of the search box needs to be altered so that it redirects the visitor to the page this module is inserted on.

Syntax

{module_searchresults render="item|collection" collection="my_custom_collection_name" template="/folder/template.tpl" hidePageNumbers=true|false hightlightType="span|bold" targetFrame=“_blank" resultsPerPage=“20" characterLimit="440" emptySearchResultString=“No results found"}

Note: When using named parameters always wrap the individual parameters in double quotes. Also, do note that modules using named parameters do not work for campaigns just yet.

Parameters

  • render - possible values are item or collection (the default is item). The render parameter indicates whether the template content is used to render a collection or to render a single item. Take a look at the render parameter's article for more details on how to use it
  • targetFrame - specifies in which frame the the results need to be opened
  • resultsPerPage - specifies the number of results the search will display per page. Default is 10 results per page.
  • characterLimit - the number of characters to be rendered in each search result
  • hidePageNumbers - show or hide pagination links. Possible values are true or false
  • hightlightType - specifies the element type used to wrap the search keywords. Possible values are:
    • bold
    • span
  • emptySearchResultString - specify the message to be displayed when no results are found
  • collection - use this if you need to access the module's Liquid output tags
  • template - render the module using a custom template. You can leave the value of the template parameter blank to suppress the original output and use Liquid output tags instead

This module can be rendered:

  • the site search layout - on this layout you can use either the legacy tags or Liquid output tags. Here is a list of all the tags you can use: Site Search Layout reference page
  • Liquid collections - here are the Liquid output tags you can use:
Liquid tag Legacy tag Description
{{counter}} {tag_counter}Incremental count of the items on the page
{{description}} {tag_description}Short description of the item
{{image_url}} {tag_image}An image reflective of the type of the item; for example, Web Page or News
{{id}} {tag_itemid}Internal ID of the item
{{type}} {tag_itemtype}Type of the item; for example, Web Page, News, Web App, or FAQ
{{name}} {tag_name_nolink}Item name without a hyperlink to the item
{tag_name}Item name with a hyperlink to the item
{{pagination}} Pagination controls:
  • currentPage
  • itemsPerPage
  • numberOfPages
  • totalItemsCount
  • previousPageUrl (null if empty)
  • nextPageUrl (null if empty)

Examples

  • {module_searchresults targetFrame="_blank" resultsPerPage="12"} - This module will display 12 results per page in the new window.

Syntax

{module_searchresults,targetFrame,resultsPerPage,hightlightType,characterLimit,hidePageNumbers,paginationLinks,No results found}

Parameters

  • targetFrame - specifies in which frame the the results need to be opened
  • resultsPerPage - specifies the number of results the search will display per page. Default is 10 results per page.
  • characterLimit - the number of characters to be rendered in each search result
  • hightlightType - specifies the element type used to wrap the search keywords. Possible values are:
    • bold
    • span
  • hidePageNumbers - show or hide pagination links. Possible values are true or false
  • emptySearchResultString - specify the message to be displayed when no results are found

Layouts

Examples

  • {module_searchresults,_blank,12,span,50,,Sorry, found no results,,>} - This module will display 12 results per page in the new window. The results body will be truncated to 50 characters. The keywords in the search results will be wrapped in a "span" element