Vulcan/server/rss.js

23 lines
706 B
JavaScript
Raw Normal View History

// serve up RSS at the right url
Meteor.serve('feed.xml', function() {
var feed = new RSS({
2013-02-28 09:40:42 +09:00
title: getSetting('title'),
2013-02-28 10:07:54 +09:00
description: getSetting('tagline'),
feed_url: Meteor.absoluteUrl()+'feed.xml',
site_url: Meteor.absoluteUrl(),
2013-02-28 11:02:21 +09:00
image_url: Meteor.absoluteUrl()+'img/favicon.png',
});
2013-02-28 09:40:42 +09:00
Posts.find({status: STATUS_APPROVED}, {sort: {submitted: -1}}).forEach(function(post) {
feed.item({
2013-02-28 09:40:42 +09:00
title: post.headline,
description: post.body+'</br></br> <a href="'+getPostUrl(post._id)+'">Comments</a>',
author: post.author,
2013-02-28 09:40:42 +09:00
date: post.submitted,
2013-02-28 11:02:21 +09:00
url: (post.url ? post.url : getPostUrl(post._id)),
guid: post._id
});
});
return feed.xml();
});