1
0
mirror of https://github.com/mbirth/wiki.git synced 2024-12-25 23:04:06 +00:00

Added Google Custom Search Engine.

This commit is contained in:
Markus Birth 2015-02-19 11:20:39 +01:00
parent ab502482a1
commit b1dcf9479a
3 changed files with 39 additions and 6 deletions

View File

@ -14,12 +14,14 @@
{% if page.toc %} {% if page.toc %}
<script src="{{ site.url }}/bower_components/jquery.toc/jquery.toc.js" type="text/javascript"></script> <script src="{{ site.url }}/bower_components/jquery.toc/jquery.toc.js" type="text/javascript"></script>
{% endif %} {% endif %}
<script src="{{ site.url }}/javascripts/gcse.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<header> <header>
<div class="container"> <div class="container">
<div id="headerleft">
<h1>{{ site.name }}</h1> <h1>{{ site.name }}</h1>
<h2>{{ site.description }}</h2> <h2>{{ site.description }}</h2>
@ -28,6 +30,10 @@
<a href="https://github.com/mbirth/wiki" class="btn btn-github"><span class="icon"></span>View on GitHub</a> <a href="https://github.com/mbirth/wiki" class="btn btn-github"><span class="icon"></span>View on GitHub</a>
</section> </section>
</div> </div>
<div id="headerright">
<gcse:search></gcse:search>
</div>
</div>
</header> </header>
<div class="container"> <div class="container">
<h1 id="pagetitle">{{ page.title }}</h1> <h1 id="pagetitle">{{ page.title }}</h1>

10
javascripts/gcse.coffee Normal file
View File

@ -0,0 +1,10 @@
---
---
cx = '005859900804634181508:3bt_l7jyk2e'
gcse = document.createElement 'script'
gcse.type = 'text/javascript'
gcse.async = true
gcse.src = '//www.google.com/cse/cse.js?cx=' + cx
s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore gcse, s

17
search.html Normal file
View File

@ -0,0 +1,17 @@
---
title: Search
---
<script>
(function() {
var cx = '005859900804634181508:3bt_l7jyk2e';
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:search></gcse:search>