1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-02-14 21:10:25 +01:00

fix search

This commit is contained in:
Matthias Kretschmann 2015-04-17 21:01:58 +02:00
parent c42ee85069
commit 5bb2f30f21
4 changed files with 21 additions and 14 deletions

View File

@ -111,7 +111,7 @@ module.exports = function(grunt){
'bower_components/jquery-infinite-scroll/jquery.infinitescroll.js', 'bower_components/jquery-infinite-scroll/jquery.infinitescroll.js',
'bower_components/masonry/dist/masonry.pkgd.js', 'bower_components/masonry/dist/masonry.pkgd.js',
'bower_components/imagesloaded/imagesloaded.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', 'bower_components/jquery.adaptive-background/index.js',
'<%= config.src %>/<%= config.assets.js %>/app.js' '<%= config.src %>/<%= config.assets.js %>/app.js'
] ]

View File

@ -26,13 +26,21 @@ var siteNavigation = {
$searchlink.click(function(e){ $searchlink.click(function(e){
e.preventDefault(); e.preventDefault();
SimpleJekyllSearch.init({
searchInput: $searchfield,
resultsContainer: $searchresults,
dataSource: '/search.json',
searchResultTemplate: '<a class="search-link" href="{url}" title="{title}">{title}</a>',
fuzzy: true
})
// init jekyll search // init jekyll search
$searchfield.jekyllSearch({ // $searchfield.jekyllSearch({
searchResults : $searchresults, // searchResults : $searchresults,
searchResultsTitle : '', // searchResultsTitle : '',
template : '<a class="search-link" href="{url}" title="{title}">{title}</a>', // template : '<a class="search-link" href="{url}" title="{title}">{title}</a>',
fuzzy : true // fuzzy : true
}); // });
// show search // show search
$searcharea.removeClass('ready bounceOutUp').addClass('ready slideDown'); $searcharea.removeClass('ready bounceOutUp').addClass('ready slideDown');

View File

@ -1,14 +1,15 @@
--- ---
layout: none
--- ---
[ [
{% for post in site.posts %} {% for post in site.posts %}
{ {
"title" : "{{ post.title | escape | titlecase }}", "title" : "{{ post.title | escape | titlecase }}",
"category" : "{{ post.categories }}", "category" : "{{ post.categories }}",
"tag" : "{{ post.tags }}", "tag" : "{{ post.tags | join: ', ' }}",
"url" : "{{ post.url }}", "url" : "{{ site.url }}{{ post.url }}",
"date" : "{{ post.date }}", "date" : "{{ post.date }}",
"content" : "{{ post.content | strip_html | strip_newlines | escape }}" "content" : "{{ post.content | strip_html | strip_newlines | escape }}"
} {% if forloop.last %}{% else %},{% endif %} } {% unless forloop.last %},{% endunless %}
{% endfor %} {% endfor %}
] ]

View File

@ -15,7 +15,7 @@
"masonry": ">=3.1.5", "masonry": ">=3.1.5",
"imagesloaded": ">=3.1.0", "imagesloaded": ">=3.1.0",
"jquery-infinite-scroll": ">=2.0.2", "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" "jquery.adaptive-background": "https://raw.github.com/briangonzalez/jquery.adaptive-backgrounds.js/master/src/jquery.adaptive-backgrounds.js"
}, },
"ignore": [ "ignore": [
@ -24,7 +24,5 @@
"bower_components", "bower_components",
"test", "test",
"tests" "tests"
], ]
"devDependencies": {
}
} }