Googleのカスタム検索を設置すると、
TypeError: google.search.Search.apiary1468 is not a function
のようなメッセージが出る場合があります。
原因は、
<script>
(function() {
var cx = ‘002268392993029149023:o5gxls7gr88’;
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>
のコードが1ページに2回以上呼び出されているからです。
上記コードは、</head>までに一度だけ記載し、
検索ボックスを設置したいところには
<gcse:searchbox-only></gcse:searchbox-only>
のみ、
検索結果を表示したいところには、
<gcse:searchresults-only></gcse:searchresults-only>
のみ記載して下さい。