From 5bb2f30f21056a8c15fe77a2c159fd8092094a94 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 17 Apr 2015 21:01:58 +0200 Subject: [PATCH] fix search --- Gruntfile.js | 2 +- _src/assets/js/app.js | 20 ++++++++++++++------ _src/search.json | 7 ++++--- bower.json | 6 ++---- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3e804688..4284fc43 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -111,7 +111,7 @@ module.exports = function(grunt){ 'bower_components/jquery-infinite-scroll/jquery.infinitescroll.js', 'bower_components/masonry/dist/masonry.pkgd.js', 'bower_components/imagesloaded/imagesloaded.js', - 'bower_components/simpleJekyllSearch/index.js', + 'bower_components/simple-jekyll-search/dest/jekyll-search.js', 'bower_components/jquery.adaptive-background/index.js', '<%= config.src %>/<%= config.assets.js %>/app.js' ] diff --git a/_src/assets/js/app.js b/_src/assets/js/app.js index 6fd10085..caa01c9a 100644 --- a/_src/assets/js/app.js +++ b/_src/assets/js/app.js @@ -26,13 +26,21 @@ var siteNavigation = { $searchlink.click(function(e){ e.preventDefault(); + SimpleJekyllSearch.init({ + searchInput: $searchfield, + resultsContainer: $searchresults, + dataSource: '/search.json', + searchResultTemplate: '{title}', + fuzzy: true + }) + // init jekyll search - $searchfield.jekyllSearch({ - searchResults : $searchresults, - searchResultsTitle : '', - template : '{title}', - fuzzy : true - }); + // $searchfield.jekyllSearch({ +// searchResults : $searchresults, +// searchResultsTitle : '', +// template : '{title}', +// fuzzy : true +// }); // show search $searcharea.removeClass('ready bounceOutUp').addClass('ready slideDown'); diff --git a/_src/search.json b/_src/search.json index a9bacc14..877688c5 100644 --- a/_src/search.json +++ b/_src/search.json @@ -1,14 +1,15 @@ --- +layout: none --- [ {% for post in site.posts %} { "title" : "{{ post.title | escape | titlecase }}", "category" : "{{ post.categories }}", - "tag" : "{{ post.tags }}", - "url" : "{{ post.url }}", + "tag" : "{{ post.tags | join: ', ' }}", + "url" : "{{ site.url }}{{ post.url }}", "date" : "{{ post.date }}", "content" : "{{ post.content | strip_html | strip_newlines | escape }}" - } {% if forloop.last %}{% else %},{% endif %} + } {% unless forloop.last %},{% endunless %} {% endfor %} ] \ No newline at end of file diff --git a/bower.json b/bower.json index ed310a0d..07da2b55 100644 --- a/bower.json +++ b/bower.json @@ -15,7 +15,7 @@ "masonry": ">=3.1.5", "imagesloaded": ">=3.1.0", "jquery-infinite-scroll": ">=2.0.2", - "simpleJekyllSearch": "https://raw.github.com/christian-fei/Simple-Jekyll-Search/master/jekyll-search.jquery.js", + "simple-jekyll-search": ">=1.0.2", "jquery.adaptive-background": "https://raw.github.com/briangonzalez/jquery.adaptive-backgrounds.js/master/src/jquery.adaptive-backgrounds.js" }, "ignore": [ @@ -24,7 +24,5 @@ "bower_components", "test", "tests" - ], - "devDependencies": { - } + ] }