Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[nodebb-script-rss] Embed an RSS feed from your blog as a NodeBB widget
<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>
@psychobunny

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.