Search for github page plugin

I use github pages to write my own blog. I want to add a search plugin . I tried Simple-Jekyll-Search and jekyll-lunr-js-search . Both worked locally with the jekyll server team. But when I upload the code to github. It does not work on github pages. Are there any suggestions?

+8
github-pages jekyll
source share
7 answers

The reason is that github pages disabled _plugins during deployment. Thus, for a simple jekyll search, if you used the simple_search_filter plugin to make a full content filter, it will not work.
One solution is to convert the site locally and direct the generated static files to the GitHub repository instead of the Jekyll source files. You can refer to this jekyll issue-325 . Also on the Jekyll homepage there is the following explanation: http://jekyllrb.com/docs/plugins/ .
Hope this helps ~

+4
source share

I am using the Google Search Engine ( https://cse.google.com/cse/ ). You just need to use the jekyll-sitemap plugin, which is included in the Github pages.

+4
source share

I have a temp solution . Follow the jekyll-lunr-js-search setup first , then paste the search index file into github. But I'm still waiting for some dynamic solutions.

0
source share

I followed the lengerfulluse suggestion and the Jekeyll website and fixed the problem. here is my solution:

manually:

  • copy _site/js/ to root
  • copy jekyll_lunr_js_search.rb to _plugin

github site, which can be found as my local site.

0
source share

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.

0
source share

You can try Jekyll Tipue Search , it is compatible with Github pages and easy to use.

0
source share

I wrote a Github Chatbot that can index and search any gh-pages site, you might find it useful:

http://www.amihaiemil.com/2017/05/23/meet-charles-michael.html

All code is on Github: https://www.github.com/opencharles/charles-rest

0
source share

All Articles