Skip to content
陈广亮的技术博客
Go back

Node 中使用 Feedly 与 RSS

使用 node-rss 生成 RSS XML:

exports.feed = function* () {
  var feed = new rss({
    title: "陈佳人",
    description: "人生是一场独自修行的道路",
    feed_url: "http://renjm.com/feed",
    site_url: "http://renjm.com",
  });

  var blogs = yield blogDB.getBlogs();
  blogs.forEach(function (v) {
    feed.item({
      title: v.title,
      description: v.realContent,
      url: "http://renjm.com/blog/" + v.id,
      date: v.addTime,
    });
  });

  this.body = feed.xml();
  this.type = "text/xml";
};

Share this post on:

Previous Post
JS Array 方法大全
Next Post
JS 字符串去重的三种方法