2015-04-19 49 views
0

我在我的網站中使用谷歌的自定義搜索引擎添加了搜索引擎。我選擇了兩個頁面佈局,因爲我想要的是搜索框將位於主頁,其結果將顯示在另一個頁面中。但它不適用於我的。每當我嘗試搜索某些內容時,它都不會顯示結果,也不會進入該頁面。我能做什麼?請幫幫我。謝謝。Google搜索引擎兩個頁面佈局不起作用

搜索框

<script> 
    (function() { 
    var cx = 'XXXXXXXX:XXXXXXX'; 
    var gcse = document.createElement('script'); 
    gcse.type = 'text/javascript'; 
    gcse.async = true; 
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + 
     '//www.google.com/cse/cse.js?cx=' + cx; 
    var s = document.getElementsByTagName('script')[0]; 
    s.parentNode.insertBefore(gcse, s); 
    })(); 
</script> 
<gcse:searchbox-only></gcse:searchbox-only> 

的結果

<script> 
    (function() { 
    var cx = 'XXXXXXXX:XXXXXXX'; 
    var gcse = document.createElement('script'); 
    gcse.type = 'text/javascript'; 
    gcse.async = true; 
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + 
     '//www.google.com/cse/cse.js?cx=' + cx; 
    var s = document.getElementsByTagName('script')[0]; 
    s.parentNode.insertBefore(gcse, s); 
    })(); 
</script> 
<gcse:searchresults-only></gcse:searchresults-only> 

回答

1

我沒有看到你的粘貼代碼,表明在搜索結果頁面應該是什麼。記錄在案here。嘗試將該位添加到僅限搜索框的標記中,例如:

<gcse:searchbox-only resultsUrl="my-desired-search-results-landing-page"></gcse:searchbox-only> 
相關問題