Skip to content

Instantly share code, notes, and snippets.

@jennifert
Last active June 1, 2017 00:58
Show Gist options
  • Save jennifert/2464a76ee1a83da91534 to your computer and use it in GitHub Desktop.
Save jennifert/2464a76ee1a83da91534 to your computer and use it in GitHub Desktop.
This is the second custom function for our search. It just look sin the JSON file using jQuery getJson.
var displyResult = function(blogTitle,blogCategory,blogTags,blogLink,blogDate,blogSummary) {
var results = '<article class="posts blogpage">'+
'<h2 class="entry-title">'+
'<a class="post-link" href="'+blogLink+'">'+blogTitle+'</a>'+
'</h2>'+
'<div class="entry-summary">'+
'<p>'+
blogSummary +
'<a href="'+blogLink+'">Continued</a>'+
'</p>'+
'</div>'+
'<span class="badge blog-date">'+
'<time class="published">'+
blogDate+
'</time>'+
'</span>'+
'<div class="pull-right">';
for (var j in blogTags) {
if (blogTags[j] === null){
} else {
results = results + ' <span class="label label-primary taggedPost"><a href="/search.html?searchbox='+blogTags[j]+'">' + blogTags[j] + '</a></span> ';
}
}
results = results + '</div>'+
'</article>';
$('div#buildResults').append(results);
};
getSearchResults('/search.json');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment