Google Search Appliance Creating the Search Experience Manual do Utilizador Página 124

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 141
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 123
Google Search Appliance: Creating the Search Experience Advanced Customization Topics 124
Including an Image Link for Results
Placing small images in the search results enhances the visual appeal of the results page. Because
experience has trained many users to click icons and pictures, it is helpful to make each image a link to
the search result, just as the result title is a link to the result. The “HTML Form Example Page” on
page 113 shows image links presented in the results pages.
XSLT Code for Image Links
The thumbnail-sized image links in the example pages are derived from a small block of XSLT code
added after the variable declarations in the “single result” section of example-frontend_stylesheet.en.xslt.
To find this block in the example stylesheet, search for the comment text “
<!--Include image
” and
look for the following code:
<!--Include image from meta tag in results list-->
<xsl:for-each select="MT">
<xsl:if test="@N='product-image' and @V!=''">
<a href="{$protocol}://{$escaped_url}">
<img align="left" height="60" width="80" src="{@V}"/>
</a>
</xsl:if>
</xsl:for-each>
The XSLT image block iterates through each
MT
(meta tag) element in the result set and tests for non-
empty values for the tag
product-image
. Then it includes the meta tag value inside a link to the results
URL as represented by the concatenated variables protocol and escaped_url.
It is important to locate this XSLT block after the variable declarations located at the beginning of the
single result” XSLT block. Because the image block uses two of these variables, it will throw an error in
the XSLT stylesheet editor if it is located before the variable is declared.
Image Meta Tag
Each product description page in this example includes a meta tag named
product-image
containing
an absolute link to a thumbnail image. Because relative links do not work in the search results page, the
meta tag values must be absolute links. For example, on mywebserver the prince nymph example page
would include this meta tag:
<meta name="product-image" content="http://www.mywebserver.com/example/images/
prince_small.jpg" />
The exact meta tag name is important, because it is required as a value for the search request
parameter
getfields
and also it is tested in a conditional clause in the XSLT code. All pages for which
you want to present a results image must include a meta tag like this one, with the name properly
referenced in the stylesheet and in
getfields
.
You must explicitly retrieve the meta tags you want from the result set in order for them to be
transformed by the XSLT code. You can do this by adding
getfields="meta_tag_name"
to your search
request, or use
getfields=
"*" to retrieve all meta tags. See the Search Protocol Reference for more
information on adding query parameters to the search request.
Vista de página 123
1 2 ... 119 120 121 122 123 124 125 126 127 128 129 ... 140 141

Comentários a estes Manuais

Sem comentários