Created
February 21, 2014 08:05
-
-
Save psychobunny/9130467 to your computer and use it in GitHub Desktop.
[nodebb-script-rss] Embed an RSS feed from your blog as a NodeBB widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table id="feed" class="table table-striped"></table> | |
<script type="text/javascript"> | |
var feed_url = 'http://blog.nodebb.org/rss'; | |
jQuery.ajax({ | |
type: "GET", | |
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(feed_url), | |
dataType: 'json', | |
success: function(data){ | |
values = data.responseData.feed.entries; | |
var list = '', count = 0; | |
jQuery.each(values, function(index, item) { | |
var date = item.publishedDate.split(' '); | |
date.pop(); | |
date = date.join(' '); | |
if (count >= 5) return; | |
list += "<tr><td><a href='" + item.link + "'>" + item.title + "</a> <br/><span class=''>" + date + "</span> </td></tr>"; | |
count ++; | |
}); | |
jQuery('#feed').html(list); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For more details, see here:
http://community.nodebb.org/topic/875/nodebb-script-rss-embed-an-rss-feed-from-your-blog-as-a-widget