mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-03 08:25:06 +03:00
86c6cec433
refs #5091, #9192, #9178 - Get the RSS module into a much better shape - Controller -> /controllers/rss - Remainder -> /services/rss - Moved tests to match & updated requires
17 lines
489 B
JavaScript
17 lines
489 B
JavaScript
var crypto = require('crypto'),
|
|
generateFeed = require('./generate-feed'),
|
|
feedCache = {};
|
|
|
|
module.exports.getXML = function getFeedXml(path, data) {
|
|
var dataHash = crypto.createHash('md5').update(JSON.stringify(data)).digest('hex');
|
|
if (!feedCache[path] || feedCache[path].hash !== dataHash) {
|
|
// We need to regenerate
|
|
feedCache[path] = {
|
|
hash: dataHash,
|
|
xml: generateFeed(data)
|
|
};
|
|
}
|
|
|
|
return feedCache[path].xml;
|
|
};
|