Google Product Forums

Why are thumbnails not displaying?


nalleyp Dec 6, 2010 11:14 AM
Posted in group: Google Custom Search

Categories: Indexing and Results :

I have implement cse on a site however I am unable to get the thumbnails to show in results. I have posted the Pagemap and my search function below. Can anyone advise if I am missing something?

in the <head> section of page:

 <PageMap>
 <DataObject type="thumbnail">
    <Attribute name="width" value="100"/>
    <Attribute name="height" value="130"/>
 </DataObject>
  </PageMap>


in body section of page:

<script type="text/javascript">
google.load('search', '1', {language : 'en', style : google.loader.themes.MINIMALIST});
   google.setOnLoadCallback(function() {
   var customSearchControl = new google.search.CustomSearchControl('xxxxxxxxxxxxxxx');
   customSearchControl.setResultSetSize(7);
  
   var options = new google.search.DrawOptions();
   google.search.Csedr.addOverride("mysite_");
   options.setSearchFormRoot(document.getElementById('cse-search-form'));
       
        customSearchControl.draw('cse', options);
     }, true);
</script>

<div style="display:none">

    <!-- Create 48px x 48px thumbnails.-->
    <div id="mysite_thumbnail">
      <div data-if="Vars.thumbnail" class="gs-image-box gs-web-image-box">
        <a class="gs-image" data-attr="{href:url, target:target}">
          <img class="gs-image" data-attr="{src:thumbnail.src, width:48, height: 48}"/>
        </a>
      </div>
    </div>

    <!-- Return the unescaped result URL.-->
    <div id="mysite_webResult">
      <div class="gs-webResult gs-result"
        data-vars="{longUrl:function() {
          var i = unescapedUrl.indexOf(visibleUrl);
          return i < 1 ? visibleUrl : unescapedUrl.substring(i);}}">

        <!-- Build the result data structure.-->
        <table>
          <tr>
            <td valign="top">
              <div data-if="Vars.richSnippet" data-attr="0"
                data-body="render('thumbnail',richSnippet,{url:unescapedUrl,target:target})"></div>
            </td>
            <td valign="top">

              <!-- Append results within the table cell.-->
              <div class="gs-title">
                <a class="gs-title" data-attr="{href:unescapedUrl,target:target}"
                  data-body="html(title)"></a>
              </div>
              <div class="gs-snippet" data-body="html(content)"></div>
              <div class="gs-visibleUrl gs-visibleUrl-short" data-body="longUrl()"></div>
              <div style="color:#676767" data-if="Vars.richSnippet && Vars.richSnippet.document">

                <!-- Insert an icon denoting the result file type.-->
                <img data-attr="{src:Vars.richSnippet.document.filetypeImage}">

                <!-- Insert the author name for this Scribd post.-->
                By <span data-body="Vars.richSnippet.document.author"></span>  - 

                <!-- Insert the number of pages in this Scribd result.-->
                <span data-body="Vars.richSnippet.document.pageCount"></span> pages - 
                
                <!-- Insert the number of times this Scribd post has been viewed.-->
                <span data-body="Vars.richSnippet.document.viewCount"></span> views
                
                <!-- Insert the last modified date-->
                 - last modified  <span data-body="Vars.richSnippet.document.timeAgo"></span>
              </div>

              <!-- Render results.-->
              <div data-if="Vars.richSnippet && Vars.richSnippet.action" class="gs-actions"
                data-body="render('action',richSnippet,{url:unescapedUrl,target:target})"></div>

            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>