Adding site directive to Google Custom Search
This commit is contained in:
parent
90c7cf7fdf
commit
90355e4319
1 changed files with 5 additions and 1 deletions
|
|
@ -156,7 +156,11 @@
|
||||||
'003065520604945464838:izzukx8-qba', customSearchOptions);
|
'003065520604945464838:izzukx8-qba', customSearchOptions);
|
||||||
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
|
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
|
||||||
customSearchControl.draw('cse');
|
customSearchControl.draw('cse');
|
||||||
customSearchControl.setSearchStartingCallback(this, function(c, s, q) { s.setQueryAddition("{{ version|e }}"); });
|
var path = window.location.pathname.split('/');
|
||||||
|
if(window.location.hostname && path.length >= 3) {
|
||||||
|
var site = "site:" + window.location.hostname + path.slice(0,3).join('/').toString();
|
||||||
|
customSearchControl.setSearchStartingCallback(this, function(c, s, q) { s.setQueryAddition(site); });
|
||||||
|
}
|
||||||
}, true);
|
}, true);
|
||||||
</script>
|
</script>
|
||||||
{%- if include_analytics %}
|
{%- if include_analytics %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue