add google custom search support

This commit is contained in:
Jiachen Yang
2012-03-12 20:51:04 +09:00
parent 57e72fb651
commit baab5dd99b
2 changed files with 21 additions and 3 deletions

View File

@@ -88,10 +88,12 @@
</li>
{% endfor %}
<li class="divider-vertical"></li>
<ul class="nav pull-right">
<li><a href="{{ SITEURL }}/archives.html"><i class="icon-th-list"></i>Archives</a></li>
</li>
</ul>
</ul>
<!--<p class="navbar-text pull-right">Logged in as <a href="#">username</a></p>-->
@@ -140,6 +142,7 @@
{% endfor %}
{% include 'twitter_profile.html' %}
{% include 'search_sidebar.html' %}
{% if SIDEBAR_CUSTOM %}
{{ SIDEBAR_CUSTOM }}

View File

@@ -0,0 +1,15 @@
{% if GOOGLE_CUSTOM_SEARCH_SIDEBAR %}
<li class="nav-header"><h4><i class="icon-search"></i>Google Search</h4></li>
<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1');
google.setOnLoadCallback(function() {
var customSearchOptions = {}; var customSearchControl = new google.search.CustomSearchControl(
'{{GOOGLE_CUSTOM_SEARCH_SIDEBAR}}', customSearchOptions);
customSearchControl.setResultSetSize(google.search.Search.SMALL_RESULTSET);
customSearchControl.draw('cse');
}, true);
</script>
<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />
{% endif %}