beautypg.com

Adding custom text code to an xslt stylesheet – Google Search Appliance Creating the Search Experience User Manual

Page 127

background image

Google Search Appliance: Creating the Search Experience

Advanced Customization Topics

127

You must explicitly retrieve the meta tags in the result set in order for them to be transformed by the
XSLT code. Do this by adding getfields=description to your search request. For more information on
getfields, see the Search Protocol Reference.

Adding Custom Text Code to an XSLT Stylesheet

To modify a stylesheet to replace the result snippet with custom text:

1.

Open the stylesheet in the Admin Console's XSLT Stylesheet Editor or your preferred editor.

2.

Scroll to the section marked by the comment .

3.

Replace the fourth line of this section, , with the
following text:





4.

Replace the last line of this section, , with the following text:

5.

Replace meta_tag_name with the name you have assigned to the meta tags storing your custom
description text. See “Description Meta Tag” on page 126 for more information.

6.

Save the stylesheet. If you are using an external editor other than the Admin Console's XSLT
Stylesheet Editor, you must also import the stylesheet into the associated front end.

7.

Verify the changes by opening the search query page and performing a test search on pages that
include description meta tags.

Configuring a Front End to Serve Secure and Public
Results

By default a front end is configured to serve only public results. You can configure a front end to serve
both secure and public results by editing the XSLT stylesheet.

To configure a front end to serve both secure and public results:

1.

In the admin console, click Serving > Front Ends.

2.

Click the Edit link next to a front end name in the list of front ends.

3.

Scroll down to see the XSLT Stylesheet Editor.

4.

Click the Edit Underlying XSLT Code link.

5.

In the XSLT stylesheet, find the following code:


...
p