The lunar javascript plugin is good for blogs with few posts as it works on the client side. However, it would be wise to move the server side search functions if you have a lot of messages. The easiest way to do this is to follow these two steps:
- Indexing your pages on Google. This can be done by providing a site map.
- Adding a custom Google search engine to your site.
1) Create a search page
--- layout: default permalink: /search/ --- <div id="home-search" class="home"> <script> (function() { var cx = '<Your CSE id>'; 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 queryParameterName="searchString"></gcse:search> </div>
2) Search form
<div id="search" align="center" style="margin-top:20px;"> <form role="search" method="get" action="/search/" class="form-inline"> <div class="form-group"> <input style="height:36px;font-size:12pt;width: 100%"; id="searchString" name="searchString" placeholder="Search on this blog..." type="text"><br/> <input style="width: 100%" class="btn" id="searchButton" name="googleSearchName" type="submit" value="Search"> </div> </form> </div>
It's pretty simple, and I wrote a detailed Jekyll setup post that also explains the above two steps along with another setup explanation.
Anand joshi
source share