I use super-search on an Atom-feed to make duckpond.ch searchable1. From super-search README:
super-search adds search feature to your blog. super-search works on your blog’s RSS feeds to enable searching posts.
I prefer Atom over RSS. Mainly because Atom is a proposed standard and there is a plugin for jekyll. Btw; RSS should also be fairly easy to integrate. Anyway here’s a patch for super-search which should make it Atom compatible 234:
--- supersearch.js.old
+++ supersearch.js.new
@@ -47,7 +47,10 @@
function getPostsFromXml(xml) {
var json = xmlToJson(xml);
- return json.channel.item;
+ if(Object.prototype.toString.call(json.entry) !== '[object Array]'){
+ return [json.entry];
+ }
+ return json.entry;
}
window.toggleSearch = function toggleSearch() {
@@ -76,7 +79,7 @@
searchResultsEl.style.offsetWidth;
var matchingPosts = posts.filter(function (post) {
- if ((post.title + '').toLowerCase().indexOf(currentInputValue) !== -1 || (post.description + '').toLowerCase().indexOf(currentInputValue) !== -1) {
+ if ((post.title + '').toLowerCase().indexOf(currentInputValue) !== -1 || (post.content + '').toLowerCase().indexOf(currentInputValue) !== -1) {
return true;
}
});
@@ -87,8 +90,8 @@
if (matchingPosts.length && currentResultHash !== lastSearchResultHash) {
searchResultsEl.classList.remove('is-hidden');
searchResultsEl.innerHTML = matchingPosts.map(function (post) {
- d = new Date(post.pubDate);
- return '<li><a href="' + post.link + '">' + post.title + '<span class="search__result-date">' + d.toUTCString().replace(/.*(\d{2})\s+(\w{3})\s+(\d{4}).*/,'$2 $1, $3') + '</span></a></li>';
+ d = new Date(post.published);
+ return '<li><a href="' + post.id + '">' + post.title + '» <span class="search__result-date">' + d.toUTCString().replace(/.*(\d{2})\s+(\w{3})\s+(\d{4}).*/,'$2 $1, $3') + '</span></a></li>';
}).join('');
}
lastSearchResultHash = currentResultHash;