beautypg.com

Xslt code for custom text, Description meta tag – Google Search Appliance Creating the Search Experience User Manual

Page 126

background image

Google Search Appliance: Creating the Search Experience

Advanced Customization Topics

126

XSLT Code for Custom Text

The product descriptions in the results for the example are derived from a small block of XSLT code
added to the “Snippet Box” section of the stylesheet. This custom block includes and augments the
default code for displaying the snippet. Note the differences and similarities in the default snippet box
and the customized version in these two examples:

Default Snippet Box









Custom Description Snippet Box











The custom description snippet block displays the description for each result that has a description
meta tag, or MT. If the XSLT engine does not find a valid description tag, it calls the standard template
rules to display the auto-generated snippet element S.

The custom version includes the rule to display a standard snippet, but applies that template only if
there is no valid description tag in the result. If you use this approach, make sure you have only one
instance of the reformat_keyword template that selects the snippet element.

Description Meta Tag

Most of the product pages in this example includes a meta tag named description that contains a
brief description of the product. For example, the copper john nymph page includes this meta tag:

All pages for which you want to present custom text must include a meta tag like the above example,
with the name properly referenced in the stylesheet and retrieved in the search request using the query
parameter getfields. For pages that do not contain valid description tags, the stylesheet uses the
automated snippet derived from page text.